Status Update
Comments
za...@capitalone.com <za...@capitalone.com> #2
I have not seen any information about it so just asking here to avoid opening another issue. It also seems that when generating APK with alpha 8 the dex is no more compressed in the APK and stored as is. Leading to way bigger APKs.
While this is not an issue when distributing via Play Store, this could have impact for all the other distribution channels. Is this a normal wanted change and we'll have to deal with it? Or is there some new parameter to control this?
za...@capitalone.com <za...@capitalone.com> #3
I can reproduce the originally reported issue of missing Baseline Profiles with AGP 8.0.0-alpha08.
To verify, check out the
sg...@google.com <sg...@google.com> #5
Created
my...@gmail.com <my...@gmail.com> #6
the location of the baseline profile has changed, it is now in dexopt folder instead of com.android.tools.build.profiles
please file a different bug for other issues so we can assign them correctly for each issue.
my...@gmail.com <my...@gmail.com> #7
There is no dexopt or any baseline profile related file in the generated aab. There is also nothing related to baseline profile in APK generated with AGP 8.0.
Can you please verify, keep the issue opened and provide a solution?
sg...@google.com <sg...@google.com> #8
As a side note I do use:
android.experimental.enableNewResourceShrinker.preciseShrinking=true
And
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:shrinkMode="strict" />
So maybe depending on when the baseline is packaged it's removed, but in all case it's not working currently so not really WAI.
sg...@google.com <sg...@google.com> #9
It's not working either for me. And I don't have android.experimental.enableNewResourceShrinker.preciseShrinking=true
and tools:shrinkMode='strict'
mk...@google.com <mk...@google.com> #10
Still happening with AGP 8.0.0-alpha09. Release build apk don't include baseline profile in assets/dexopt/
ap...@google.com <ap...@google.com> #11
When they quickly close like that without checking on most part of the tracker anything written after is just plain ignored..
Need to reopen an issue, since no access to proper category hope again that triage put it in the proper place then hope that this time it's properly read.
If only all the parts could be like the R8/D8 part of this issue tracker.
ap...@google.com <ap...@google.com> #12
Scott, can you have a look if modifying an app according to
ap...@google.com <ap...@google.com> #13
I'm not able to reproduce.
Ben, the link to the repro project from
ap...@google.com <ap...@google.com> #14
Is there any logs I can provide from the build to help figure out?
ap...@google.com <ap...@google.com> #15
For the record also tested with A9 and there's the result on Windows.
Image is content of the aab (res and BUNDLE-METADATA)
And the result of a search on all the app folder including all the build dirs after the build
PS D:\_Gradle\Symfonik> Get-Childitem -Include *baseline* -Recurse
Directory: D:\_Gradle\Symfonik\app\src\main
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 29/11/2022 10:58 2114655 baseline-prof.txt
Directory: D:\_Gradle\Symfonik\benchmark\src\main\java\app\symfonik\benchmark
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 29/11/2022 10:48 baselineprofile
Directory: D:\_Gradle\Symfonik\benchmark\src\main\java\app\symfonik\benchmark\baselineprofile
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 29/11/2022 10:48 1231 BaselineProfileGenerator.kt
Reverting to A7 generates an aab that is 15k larger (the size of the baseline)
And the search after the build gives:
PS D:\_Gradle\Symfonik> Get-Childitem -Include *baseline* -Recurse
Directory: D:\_Gradle\Symfonik\app\build\intermediates\binary_art_profile\release
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 02/12/2022 20:17 14796 baseline.prof
Directory: D:\_Gradle\Symfonik\app\build\intermediates\binary_art_profile_metadata\release
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 02/12/2022 20:17 1805 baseline.profm
Directory: D:\_Gradle\Symfonik\app\build\intermediates\merged_art_profile\release
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 02/12/2022 20:12 2303810 baseline-prof.txt
Directory: D:\_Gradle\Symfonik\app\src\main
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 29/11/2022 10:58 2114655 baseline-prof.txt
Directory: D:\_Gradle\Symfonik\benchmark\src\main\java\app\symfonik\benchmark
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 29/11/2022 10:48 baselineprofile
Directory: D:\_Gradle\Symfonik\benchmark\src\main\java\app\symfonik\benchmark\baselineprofile
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 29/11/2022 10:48 1231 BaselineProfileGenerator.kt
So the files are properly generated in binary_art_profile
for A7 and completely missing in A8 / A9. This does not sound like a packaging issue (Same behavior without the options from #8) but more a missing generation step.
This is a full compose app, no jetifier, minsdk 28, no png generation, ultra optimized everywhere I can, so maybe the build step depends on a step that is missing now?
ap...@google.com <ap...@google.com> #16
Thanks. I'm able to repro now with the correct link
ap...@google.com <ap...@google.com> #17
It looks like this was caused by Change-Id: I68ab3a6f342327cfb4c5477f85941fa3a6434a81. When I revert that change, the issue goes away. Working on a fix...
ap...@google.com <ap...@google.com> #20
This will be fixed in AGP 8.0.0-beta02 (Change-Id: Icb1a29bcd0c60a8ee6228a5ee05e708624c319c0)
mk...@google.com <mk...@google.com> #21
Thanks a lot, just to be sure this was also tested with both options from #8?
my...@gmail.com <my...@gmail.com> #22
So updated to AGP 8.0 A10 and the profiles are back but still in com.android.tools.build.profiles
this contradicts #6 is this normal/expected will it change in a future 8.0 build?
mk...@google.com <mk...@google.com> #23
Re #22, please disregard #6... that only applies to APKs, not AABs.
dm...@izettle.com <dm...@izettle.com> #24
mk...@google.com <mk...@google.com> #25
The fix will be in AGP 8.0.0-beta02 and AGP 8.1.0-alpha01
dm...@izettle.com <dm...@izettle.com> #26
Yes, my previous stacktrace was from 4.0.48. It was trickier to update than I thought. After really updating to 4.0.51 I started to get new trace
Caused by: java.lang.NullPointerException
at com.android.tools.r8.shaking.Enqueuer.markTypeAsLive(Enqueuer.java:2012)
at com.android.tools.r8.shaking.Enqueuer.traceTypeReference(Enqueuer.java:1388)
at com.android.tools.r8.shaking.DefaultEnqueuerUseRegistry.registerTypeReference(DefaultEnqueuerUseRegistry.java:174)
at com.android.tools.r8.cf.code.CfFrame.internalRegisterUse(CfFrame.java:273)
at com.android.tools.r8.cf.code.CfFrame.lambda$internalRegisterUse$1(CfFrame.java:264)
at com.android.tools.r8.cf.code.CfFrame.internalRegisterUse(CfFrame.java:264)
at com.android.tools.r8.cf.code.CfInstruction.registerUse(CfInstruction.java:104)
at com.android.tools.r8.graph.CfCode.registerCodeReferences(CfCode.java:683)
at com.android.tools.r8.graph.LazyCfCode.registerCodeReferences(LazyCfCode.java:284)
at com.android.tools.r8.graph.ProgramMethod.registerCodeReferences(ProgramMethod.java:127)
at com.android.tools.r8.shaking.Enqueuer.traceCode(Enqueuer.java:4809)
at com.android.tools.r8.shaking.Enqueuer.traceNonDesugaredCode(Enqueuer.java:4803)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsLive(Enqueuer.java:4742)
at com.android.tools.r8.shaking.EnqueuerWorklist$MarkMethodLiveAction.run(EnqueuerWorklist.java:166)
at com.android.tools.r8.shaking.Enqueuer.trace(Enqueuer.java:4395)
at com.android.tools.r8.shaking.Enqueuer.traceApplication(Enqueuer.java:3622)
at com.android.tools.r8.R8.runEnqueuer(R8.java:1012)
at com.android.tools.r8.R8.run(R8.java:369)
at com.android.tools.r8.R8.run(R8.java:252)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:243)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
... 35 more
R8 is a new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name.
Current version is: 4.0.51 (build 41681a871b6a304b5c57388bf833ab1417e17ca9 from go/r8bot (luci-r8-custom-ci-bionic-22-vlxz)).
mk...@google.com <mk...@google.com>
dm...@izettle.com <dm...@izettle.com> #27
FYI. Downgrading R8 to 3.3.75 solved the issue.
dm...@izettle.com <dm...@izettle.com> #29
I don't think I can share a dump, it will be against company policy, sorry.
mk...@google.com <mk...@google.com> #30
Can you try to run with assertions enabled then?
./gradlew assembleRelease -Dorg.gradle.jvmargs='-ea:com.android.tools.r8'
or set the jvmargs in the gradle properties. Hopefully we will see where the error first appear then.
dm...@izettle.com <dm...@izettle.com> #31
I did this and I got these messages. There were more lines like that, I removed project-specific ones for security reasons. Is this what you was looking for?
Unable to find common super type for androidx/window/extensions/embedding/SplitPlaceholderRule and androidx/window/extensions/embedding/ActivityRule.
Unable to find common super type for androidx/window/extensions/embedding/SplitPairRule and java/lang/Object.
Unable to find common super type for com/google/common/util/concurrent/ListenableFuture and java/util/ArrayList.
Unable to find common super type for kotlin/Pair and java/lang/Object.
Unable to find common super type for okhttp3/Response and java/lang/Object.
Unable to find common super type for okhttp3/OkHttpClient and java/lang/Object.
Unable to find common super type for java/lang/Object and kotlin/Pair.
Unable to find common super type for java/lang/Exception and com/google/android/gms/tasks/Task.
Unable to find common super type for kotlinx/coroutines/CoroutineScope and java/lang/Object.
Unable to find common super type for java/lang/Object and kotlinx/coroutines/CoroutineScope.
Unable to find common super type for java/lang/NoClassDefFoundError and [REDACTED].
Current version is: 4.0.51 (build 41681a871b6a304b5c57388bf833ab1417e17ca9 from go/r8bot (luci-r8-custom-ci-bionic-22-vlxz)).
mk...@google.com <mk...@google.com> #32
No, that is not what I was looking for I am looking for a stack trace that is not the NPE. Running with assertions enabled should give a better indication of the origin of the error. The problem is that an object is constructed with a field that is null
. That is the NPE you are seeing. Internally we have an assert that such an object cannot be created so running with assertions would move the exception to creation time.
Potentially the argument should be:
-ea:com.android.tools.r8...
You should be able to specify it both by the command line and the gradle.properties file.
Please also run with --no-daemon
to ensure it will create a fresh VM.
dm...@izettle.com <dm...@izettle.com> #33
I did ./gradlew assembleRelease -Dorg.gradle.jvmargs='-ea:com.android.tools.r8' --no-daemon --stacktrace
and got the same stacktrace as initially, the one with NPE.
mk...@google.com <mk...@google.com> #34
Did you try:
./gradlew assembleRelease -Dorg.gradle.jvmargs='-ea:com.android.tools.r8...' --no-daemon --stacktrace
(notice the dots in the end of r8.)
dm...@izettle.com <dm...@izettle.com> #35
I've tried with dots and got new callstack :)
Caused by: java.lang.NullPointerException
at com.android.tools.r8.cf.code.frame.UninitializedNew.<init>(UninitializedNew.java:22)
at com.android.tools.r8.cf.code.frame.FrameType.uninitializedNew(FrameType.java:135)
at com.android.tools.r8.graph.LazyCfCode$MethodCodeVisitor.getFrameType(LazyCfCode.java:542)
at com.android.tools.r8.graph.LazyCfCode$MethodCodeVisitor.parseStack(LazyCfCode.java:521)
at com.android.tools.r8.graph.LazyCfCode$MethodCodeVisitor.visitFrame(LazyCfCode.java:501)
at com.android.tools.r8.org.objectweb.asm.ClassReader.readCode(ClassReader.java:2068)
at com.android.tools.r8.org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
at com.android.tools.r8.org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
at com.android.tools.r8.org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
at com.android.tools.r8.graph.LazyCfCode.parseCode(LazyCfCode.java:205)
at com.android.tools.r8.graph.LazyCfCode.internalParseCode(LazyCfCode.java:161)
at com.android.tools.r8.utils.ExceptionUtils.lambda$withOriginAndPositionAttachmentHandler$5(ExceptionUtils.java:238)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAndPositionAttachmentHandler(ExceptionUtils.java:246)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAndPositionAttachmentHandler(ExceptionUtils.java:234)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAttachmentHandler(ExceptionUtils.java:225)
at com.android.tools.r8.graph.LazyCfCode.asCfCode(LazyCfCode.java:143)
at com.android.tools.r8.ir.desugar.NonEmptyCfInstructionDesugaringCollection.needsDesugaring(NonEmptyCfInstructionDesugaringCollection.java:349)
at com.android.tools.r8.shaking.Enqueuer.addToPendingDesugaring(Enqueuer.java:4004)
at com.android.tools.r8.shaking.Enqueuer.traceNonDesugaredCode(Enqueuer.java:4798)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsLive(Enqueuer.java:4742)
at com.android.tools.r8.shaking.EnqueuerWorklist$MarkMethodLiveAction.run(EnqueuerWorklist.java:166)
at com.android.tools.r8.shaking.Enqueuer.trace(Enqueuer.java:4395)
at com.android.tools.r8.shaking.Enqueuer.traceApplication(Enqueuer.java:3622)
at com.android.tools.r8.R8.runEnqueuer(R8.java:1012)
at com.android.tools.r8.R8.run(R8.java:369)
at com.android.tools.r8.R8.run(R8.java:252)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:243)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
... 35 more
Suppressed: com.android.tools.r8.utils.ExceptionUtils$OriginAttachmentException: java.lang.NullPointerException
at com.android.tools.r8.utils.ExceptionUtils$OriginAttachmentException.wrap(ExceptionUtils.java:258)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAndPositionAttachmentHandler(ExceptionUtils.java:248)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAndPositionAttachmentHandler(ExceptionUtils.java:234)
at com.android.tools.r8.utils.ExceptionUtils.withOriginAttachmentHandler(ExceptionUtils.java:225)
at com.android.tools.r8.graph.LazyCfCode.asCfCode(LazyCfCode.java:143)
at com.android.tools.r8.ir.desugar.NonEmptyCfInstructionDesugaringCollection.needsDesugaring(NonEmptyCfInstructionDesugaringCollection.java:349)
at com.android.tools.r8.shaking.Enqueuer.addToPendingDesugaring(Enqueuer.java:4004)
at com.android.tools.r8.shaking.Enqueuer.traceNonDesugaredCode(Enqueuer.java:4798)
at com.android.tools.r8.shaking.Enqueuer.markMethodAsLive(Enqueuer.java:4742)
at com.android.tools.r8.shaking.EnqueuerWorklist$MarkMethodLiveAction.run(EnqueuerWorklist.java:166)
at com.android.tools.r8.shaking.Enqueuer.trace(Enqueuer.java:4395)
at com.android.tools.r8.shaking.Enqueuer.traceApplication(Enqueuer.java:3622)
at com.android.tools.r8.R8.runEnqueuer(R8.java:1012)
at com.android.tools.r8.R8.run(R8.java:369)
at com.android.tools.r8.R8.run(R8.java:252)
at com.android.tools.r8.R8.lambda$runForTesting$1(R8.java:243)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
at com.android.tools.r8.utils.ExceptionUtils.withR8CompilationHandler(ExceptionUtils.java:69)
at com.android.tools.r8.R8.runForTesting(R8.java:239)
at com.android.tools.r8.R8.run(R8.java:187)
at com.android.builder.dexing.R8Tool.runR8(r8Tool.kt:308)
at com.android.build.gradle.internal.tasks.R8Task$Companion.shrink(R8Task.kt:642)
at com.android.build.gradle.internal.tasks.R8Task$R8Runnable.execute(R8Task.kt:712)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:212)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
at org.gradle.internal.Factories$1.create(Factories.java:31)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: [CIRCULAR REFERENCE: java.lang.NullPointerException]
ap...@google.com <ap...@google.com> #36
Branch: main
commit d3be3e93b26b4797fcfa4b071da30e5184ac27b5
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Thu Feb 02 10:38:36 2023
Throw compilation error with origin when failing to parse code
Bug:
Change-Id: I358dc5d95aacfe448ec9d1e2d5e5d5deb4921631
M src/main/java/com/android/tools/r8/graph/LazyCfCode.java
mk...@google.com <mk...@google.com> #37
I've created a new CL ToT that will show the origin of the class-file we cannot parse. Hopefully you can share that library/file with us. To use the new version, you have amend your build.gradle file:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw/main")
}
}
dependencies {
classpath("com.android.tools:r8:d3be3e93b26b4797fcfa4b071da30e5184ac27b5")
classpath('com.google.guava:guava:30.1.1-jre') // <-- THIS IS REQUIRED UNTIL R8 3.2.4-dev
}
}
}
(Note that the maven repository is different)
Then run the .gradlew command again.
mk...@google.com <mk...@google.com> #38
I will close this bug waiting for answer since it marked as P1 and cannot change it since we backported an issue. Please open a new bug when you have the source files that we cannot parse.
Description
Getting the following exception when executing
:app:minifyVariantWithR8
when upgrading to7.4.0-beta02
. This worked without issues with AGP7.3.0
.