Fixed
Status Update
Comments
im...@google.com <im...@google.com> #3
Can we get the full stacktrace? (run with --stacktrace).
thanks!
thanks!
im...@google.com <im...@google.com> #4
Desugar needs to check if the EnclosingMethod attribute (https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.7 ), contains a reference to a method from an interface. Reason is that those methods will be moved to companion classes, and value of these attributes will be incorrect, which might confuse Proguard. Therefore, it will just remove them from the class, if owner is an interface.
So, in your case, while analyzing SomeClass$someMethod$1$1$2$1, Desugar will find EnclosingMethod attribute, and the value of the outer class will be SomeClass$someMethod$1$1$2. Then, it will try to determine if that class is an interface, but it is missing from the jar, so it fails with the error in #1. Can you please check if the missing class is in the jar? Or you doing any bytecode rewriting/generating yourself before Desugar runs?
So, in your case, while analyzing SomeClass$someMethod$1$1$2$1, Desugar will find EnclosingMethod attribute, and the value of the outer class will be SomeClass$someMethod$1$1$2. Then, it will try to determine if that class is an interface, but it is missing from the jar, so it fails with the error in #1. Can you please check if the missing class is in the jar? Or you doing any bytecode rewriting/generating yourself before Desugar runs?
mb...@gmail.com <mb...@gmail.com> #5
No, before beta-1 or 3.2.0-alpha01 there's no problem with building or testing.
The class is normal Kotlin object-class (singleton), there're some other similar classes in the project, however, no errors would be fired from them.
The class is normal Kotlin object-class (singleton), there're some other similar classes in the project, however, no errors would be fired from them.
im...@google.com <im...@google.com> #6
Can you upload .calss files for SomeClass$someMethod$1$1$2$1,and for SomeClass$someMethod$1$1$2? If you are able to provide source code that reproduces the issues, that would help greatly.
Description
AI-171.4408382, JRE 1.8.0_152-release-915-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080
IMPORTANT: Please read
Gradle Version: 4.1
Android Plugin Version: 3.0.0
TargetSDK (compiledSDK): 26
MinSDK: 21
Build Tools Version: 27.0.0 (latest - using default setting which points to latest installed)
Android SDK Tools: 26.1.1
Project Setup:
I have a project containing 5 .aar libraries (resources, toolbox, ui, web, race). - see screenshot1
It is using two build flavors: "api21" and "api17". The name tells the minimum sdk. - see screenshot2
buildConfigs are standard: debug and release, minifyEnabled=false on .aar level (I minify on apk level in the app-project)
Funny thing: The error below tells me something about "layout-v16" ... My minSdk is set to 21! I do not have a single piece of code/xml that points to anything below api17!
How to reproduce:
* start the "assembly" task FOR THE FIRST TIME, it runs through without error.
* Then change something in the xml "themes.xml" or "styles.xml" of the resources library (which contains only xml - no java code)
* try to assemble again -> see crash below
I can reproduce it 100% of the time.
Happens only (as far as i can tell) when xml resources are changed. Java code changes cause no harm here.
How to solve:
* I am forced to do a "Rebuild project" manually (Build -> Rebuild project), then "assemble" will work again ... for ONE RUN. Then again "rebuild project" is forced. This consumes lots of time...
Even worse: What happens in the APP project that uses this library?
* After EVERY new "assemble" of the library, I can not build the app.
* Only solution (and this is cruel): File -> Invalidate caches and restart - I have to do this EVERY TIME, a new version of the library is assembled!
* it seems, there are (too?) many things cached from aar references.
* When I click the "run" button to deploy the app to my emulator, gradle tells me:
Executing tasks: [:app:assembleDebug]
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
??
build.gradle for my app: contains this block for the references to my .aars:
compile(name:'race-api21-release', ext:'aar')
compile(name:'resources-api21-release', ext:'aar')
compile(name:'toolbox-api21-release', ext:'aar')
compile(name:'ui-api21-release', ext:'aar')
compile(name:'web-api21-release', ext:'aar')
Here is the complete stacktrace from my gradle console - LIBRARIES PROJECT
:ui:verifyApi21ReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ui:verifyApi21ReleaseResources'.
> com.android.builder.internal.aapt.AaptException: Failed to compile file C:\Work\Dev\Git\and-platform\ui\build\intermediates\res\merged\api21\release\layout-v16
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ui:verifyApi21ReleaseResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.UncheckedException: com.android.builder.internal.aapt.AaptException: Failed to compile file C:\Work\Dev\Git\and-platform\ui\build\intermediates\res\merged\api21\release\layout-v16
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 27 more
Caused by: com.android.builder.internal.aapt.AaptException: Failed to compile file C:\Work\Dev\Git\and-platform\ui\build\intermediates\res\merged\api21\release\layout-v16
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.compileResources(VerifyLibraryResourcesTask.java:190)
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.compileAndVerifyResources(VerifyLibraryResourcesTask.java:146)
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.doIncrementalTaskAction(VerifyLibraryResourcesTask.java:107)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:113)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
... 37 more