Fixed
Status Update
Comments
js...@google.com <js...@google.com> #2
Thank you for the report. Usually, that message---use (extends|implements) but actually matches (implements|extends)---is a warning so that hopefully users can switch to a correct rule. If your task `App:transformClassesAndResourcesWithR8ForRelease` is failing, there should be something else. Could you try:
$ ./gradlew clean assembleRelease --stacktrace
and let us know the full stack trace?
$ ./gradlew clean assembleRelease --stacktrace
and let us know the full stack trace?
js...@google.com <js...@google.com> #3
Another thing I noticed is:
> D8: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.
So, probably, you have only `-keepattributes Signature`. As it said, you need InnerClasses attribute too, which also requires EnclosingMethod attributes:
`-keepattributes Signature,InnerClasses,EnclosingMethod`
If you're not using R8 full mode, though, adding one of InnerClasses or EnclosingMethod will automatically add another one.
> D8: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.
So, probably, you have only `-keepattributes Signature`. As it said, you need InnerClasses attribute too, which also requires EnclosingMethod attributes:
`-keepattributes Signature,InnerClasses,EnclosingMethod`
If you're not using R8 full mode, though, adding one of InnerClasses or EnclosingMethod will automatically add another one.
su...@gmail.com <su...@gmail.com> #4
Thanks for looking into this.
Please find the attachment for the full stack trace.
And yes you are right I do need to add InnerClasses and EnclosingMethod. I will add that.
Please find the attachment for the full stack trace.
And yes you are right I do need to add InnerClasses and EnclosingMethod. I will add that.
js...@google.com <js...@google.com> #5
Thank you for the quick turnaround. The error line is:
Caused by: com.android.tools.r8.utils.AbortException: Error: Undefined value encountered during compilation. This is typically caused by invalid dex input that uses a register that is not define on all control-flow paths leading to the use.
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:101)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:72)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:66)
... 79 more
which looks more serious now. (FYI, one similar issue we had so far was issue 111487514 .)
Would you mind sharing the project with us? You can send it privately to either jsjeon@google.com or christofferqa@google.com If that doesn't work for you, as I did at issue 111487514 , we might ask you run a locally built R8 to extensively log and nail down the issue. Please let us know which way you prefer.
Caused by: com.android.tools.r8.utils.AbortException: Error: Undefined value encountered during compilation. This is typically caused by invalid dex input that uses a register that is not define on all control-flow paths leading to the use.
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:101)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:72)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:66)
... 79 more
which looks more serious now. (FYI, one similar issue we had so far was
Would you mind sharing the project with us? You can send it privately to either jsjeon@google.com or christofferqa@google.com If that doesn't work for you, as I did at
su...@gmail.com <su...@gmail.com> #6
I will go with your later approach let me know what I have to do.
And I will go through " issue 111487514 " as well when I get a chance.
Thanks,
And I will go through "
Thanks,
rm...@google.com <rm...@google.com>
ch...@google.com <ch...@google.com>
js...@google.com <js...@google.com> #7
Please don't waste your time to go through issue 111487514 because it's half an year ago, and probably totally different issue. I'll prepare logging stuff today.
js...@google.com <js...@google.com> #8
Could you run the attached r8.jar by editing your top-level gradle file like this?
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
$ ./gradlew clean assembleRelease
Even though we have a similar issue on ToT ( issue 131207184 ), I prepared the logging on top of R8 1.4.77, just in case. See the attached diff.
If the logs are too verbose and you don't want to share that publicly, you can send it to jsjeon@google.com Thanks!
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
$ ./gradlew clean assembleRelease
Even though we have a similar issue on ToT (
If the logs are too verbose and you don't want to share that publicly, you can send it to jsjeon@google.com Thanks!
su...@gmail.com <su...@gmail.com> #9
I just send the logs to your email. Let me know how it goes.
js...@google.com <js...@google.com> #10
Thank you for running it and sending the log to me. Since the input indicates `com/google/android/gms/measurement/internal/...`, I'd like to learn more about recent dependency changes. Could you let us know what libraries (and versions) you're using? I guess that `measurement` may come from Firebase?
js...@google.com <js...@google.com> #11
Unfortunately, my attempt to reproduce the issue didn't work. :\ (Attached is jasmin code from your logs.)
I noticed a couple things I missed, though. First of all, switching back to 1.4 changed some gradle setting, and it seems like I uploaded local r8.jar built from ToT. (Your log said it's from R8 1.5.21-dev.) That's good, actually, because it's going to be same as issue 131207184 . Another one is, I forgot to capture method signatures. As shown in the attached .j, I inferred method signature, and maybe that's why IR building in D8/R8 passed smoothly.
So, could you run logging one more time? See attached r8.jar and diff. This time, I'm trying to capture method signature, original .class file input, and internal state of IR builder. Thanks!
I noticed a couple things I missed, though. First of all, switching back to 1.4 changed some gradle setting, and it seems like I uploaded local r8.jar built from ToT. (Your log said it's from R8 1.5.21-dev.) That's good, actually, because it's going to be same as
So, could you run logging one more time? See attached r8.jar and diff. This time, I'm trying to capture method signature, original .class file input, and internal state of IR builder. Thanks!
su...@gmail.com <su...@gmail.com> #12
Sure thing I just send the logs to your email.
And if you need here are the list of firebase libraries used in the project
com.google.firebase:firebase-appindexing:17.1.0
com.google.firebase:firebase-core:16.0.8
com.google.firebase:firebase-messaging:17.6.0
com.google.firebase:firebase-ml-vision:18.0.2
com.google.firebase:firebase-ml-vision-image-label-model:17.0.2
com.google.firebase:firebase-perf:16.2.5
And the list of google play libraries
com.google.android.gms:play-services-safetynet:16.0.0
com.google.android.gms:play-services-location:16.0.0
com.google.android.gms:play-services-maps:16.1.0
com.google.android.gms:play-services-ads:16.0.0
com.google.android.gms:play-services-wearable:16.0.
And the top level build script dependencies
classpath "com.google.gms:google-services:4.2.0"
classpath 'com.google.firebase:firebase-plugins:1.2.0'
And if you need here are the list of firebase libraries used in the project
com.google.firebase:firebase-appindexing:17.1.0
com.google.firebase:firebase-core:16.0.8
com.google.firebase:firebase-messaging:17.6.0
com.google.firebase:firebase-ml-vision:18.0.2
com.google.firebase:firebase-ml-vision-image-label-model:17.0.2
com.google.firebase:firebase-perf:16.2.5
And the list of google play libraries
com.google.android.gms:play-services-safetynet:16.0.0
com.google.android.gms:play-services-location:16.0.0
com.google.android.gms:play-services-maps:16.1.0
com.google.android.gms:play-services-ads:16.0.0
com.google.android.gms:play-services-wearable:16.0.
And the top level build script dependencies
classpath "com.google.gms:google-services:4.2.0"
classpath 'com.google.firebase:firebase-plugins:1.2.0'
js...@google.com <js...@google.com> #13
The logs begin with:
```
[R8-logging]: void com.google.android.gms.measurement.internal.zzfz.zza(java.lang.StringBuilder, java.lang.String, com.google.android.gms.internal.measurement.zzbt$zzf, java.lang.String)
[R8-logging]: original:
L0
LINENUMBER 216 L0
ALOAD 4
IFNONNULL L1
L2
LINENUMBER 217 L2
RETURN
L1
LINENUMBER 218 L1
IINC 2 1
L3
LINENUMBER 219 L3
...
```
where bytecode `iinc 2 1` failed because, as shown in the signature, 2nd argument is not an integer type.
IR builder's internal state up to that point is:
```
[R8-logging]: IR:
blocks:
block 0, pred-counts: 0, succ-count: 2, filled: true, sealed: true
predecessors: -
successors: 1 <unknown> (no try/catch successors)
v5 <- phi() : INT
#0: -1: Argument v0 <-
: -1: Argument v1 <-
: -1: Argument v2 <-
: -1: Argument v3 <-
: -1: Argument v4 <-
#216: -1: If v3 NEZ block 1 (fallthrough <unknown>)
block 1, pred-counts: 1, succ-count: 0, filled: false, sealed: true
predecessors: 0
successors: -
no phis
```
So, yes, it failed really early. When I added `I` to the signature of the method in the .j file (at comment #11 ), it is compiled well.
Found the following dependency:
com.google.firebase:firebase-core:16.0.8
> com.google.firebase:firebase-analytics:16.4.0
> com.google.android.gms:play-service-measurement:16.4.0
And from here:https://mvnrepository.com/artifact/com.google.android.gms/play-services-measurement/16.4.0 got an aar file (attached), and there, found the class that appears in the log (attached).
$ javap -c -p zzfz.class
...
private final void zza(java.lang.StringBuilder, int, java.lang.String, com.google.android.gms.internal.measurement.zzbt$zzf, java.lang.String);
Code:
0: aload 4
2: ifnonnull 6
5: return
6: iinc 2, 1
9: aload_1
So, it seems R8's unused argument removal optimization incorrectly removed 2nd argument.
Actually, from the string constant, I can search for the google internal code that corresponds to `zza`, which clearly shows that the signature has `int`.
https://cs.corp.google.com/search/?q=com.google.android.gms.measurement.internal+dynamic_filter_timestamps
```
[R8-logging]: void com.google.android.gms.measurement.internal.zzfz.zza(java.lang.StringBuilder, java.lang.String, com.google.android.gms.internal.measurement.zzbt$zzf, java.lang.String)
[R8-logging]: original:
L0
LINENUMBER 216 L0
ALOAD 4
IFNONNULL L1
L2
LINENUMBER 217 L2
RETURN
L1
LINENUMBER 218 L1
IINC 2 1
L3
LINENUMBER 219 L3
...
```
where bytecode `iinc 2 1` failed because, as shown in the signature, 2nd argument is not an integer type.
IR builder's internal state up to that point is:
```
[R8-logging]: IR:
blocks:
block 0, pred-counts: 0, succ-count: 2, filled: true, sealed: true
predecessors: -
successors: 1 <unknown> (no try/catch successors)
v5 <- phi() : INT
#0: -1: Argument v0 <-
: -1: Argument v1 <-
: -1: Argument v2 <-
: -1: Argument v3 <-
: -1: Argument v4 <-
#216: -1: If v3 NEZ block 1 (fallthrough <unknown>)
block 1, pred-counts: 1, succ-count: 0, filled: false, sealed: true
predecessors: 0
successors: -
no phis
```
So, yes, it failed really early. When I added `I` to the signature of the method in the .j file (at
Found the following dependency:
com.google.firebase:firebase-core:16.0.8
> com.google.firebase:firebase-analytics:16.4.0
> com.google.android.gms:play-service-measurement:16.4.0
And from here:
$ javap -c -p zzfz.class
...
private final void zza(java.lang.StringBuilder, int, java.lang.String, com.google.android.gms.internal.measurement.zzbt$zzf, java.lang.String);
Code:
0: aload 4
2: ifnonnull 6
5: return
6: iinc 2, 1
9: aload_1
So, it seems R8's unused argument removal optimization incorrectly removed 2nd argument.
Actually, from the string constant, I can search for the google internal code that corresponds to `zza`, which clearly shows that the signature has `int`.
js...@google.com <js...@google.com> #14
I just reproduced the issue on ToT. Even though several other issues mentioned AS 3.4.0 (R8 1.4.77), I think they all share the same root cause.
js...@google.com <js...@google.com> #15
I merged all seemingly related issues to this one. Attached is r8.jar built with a tentative fix (https://r8-review.googlesource.com/c/r8/+/37740 ). Can someone try this? As mentioned at comment #8 , you need to update the top-level build.gradle as follows:
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
va...@gmail.com <va...@gmail.com> #16
`assembleRelease` with the local r8.jar file and Android Gradle Plugin 3.4.0 does work on my project. Are you sure we should be using 3.4.0 instead of 3.5.0-alpha13 though?
su...@gmail.com <su...@gmail.com> #17
Now I'm seeing a different build failure with your recent r8.jar. I send you the whole logs to your email ID.
> Task :App:transformClassesAndResourcesWithR8ForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':App:transformClassesAndResourcesWithR8ForRelease'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':App:transformClassesAndResourcesWithR8ForRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119)
at org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43)...
> Task :App:transformClassesAndResourcesWithR8ForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':App:transformClassesAndResourcesWithR8ForRelease'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':App:transformClassesAndResourcesWithR8ForRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119)
at org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43)...
js...@google.com <js...@google.com> #18
Sorry for any inconvenience so far. Maybe too early to collapse all issues into one; each reporter sees different results, so I'm decoupling them.
ap...@google.com <ap...@google.com> #19
Project: r8
Branch: master
commit 522bd9fc1d398753fed5134b6c4fe32cdae482be
Author: Jinseong Jeon <jsjeon@google.com>
Date: Sun Apr 28 14:28:53 2019
Account for IINC instruction when collecting arg uses in jar code.
Bug: 131140696, 131207184, 131443760, 130789358
Change-Id: I8fba2eb7dc2b814b2f21f2ba4fc634bf7bb58dd1
M src/main/java/com/android/tools/r8/jar/JarArgumentUseVisitor.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsIntTest.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsTestBase.java
https://r8-review.googlesource.com/37740
Branch: master
commit 522bd9fc1d398753fed5134b6c4fe32cdae482be
Author: Jinseong Jeon <jsjeon@google.com>
Date: Sun Apr 28 14:28:53 2019
Account for IINC instruction when collecting arg uses in jar code.
Bug: 131140696, 131207184, 131443760, 130789358
Change-Id: I8fba2eb7dc2b814b2f21f2ba4fc634bf7bb58dd1
M src/main/java/com/android/tools/r8/jar/JarArgumentUseVisitor.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsIntTest.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsTestBase.java
js...@google.com <js...@google.com> #20
ap...@google.com <ap...@google.com> #21
Project: r8
Branch: d8-1.4
commit 7c81a6c1d74eece58960b8fdee852d409af5b8b9
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Mon Apr 29 09:08:31 2019
Version 1.4.93
Cherry pick: Account for IINC instruction when collecting arg uses in jar code.
CL:https://r8-review.googlesource.com/c/r8/+/37740
Bug: 131140696, 131207184, 131443760, 130789358
Change-Id: Ic36eacad6f11d821b3207c42b9fecfc40375c2d2
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/jar/JarArgumentUseVisitor.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsIntTest.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsTestBase.java
https://r8-review.googlesource.com/37725
Branch: d8-1.4
commit 7c81a6c1d74eece58960b8fdee852d409af5b8b9
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Mon Apr 29 09:08:31 2019
Version 1.4.93
Cherry pick: Account for IINC instruction when collecting arg uses in jar code.
CL:
Bug: 131140696, 131207184, 131443760, 130789358
Change-Id: Ic36eacad6f11d821b3207c42b9fecfc40375c2d2
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/jar/JarArgumentUseVisitor.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsIntTest.java
M src/test/java/com/android/tools/r8/ir/optimize/unusedarguments/UnusedArgumentsTestBase.java
js...@google.com <js...@google.com> #23
The fix for the original issue (Undefined value...) is landed in R8 1.4 branch ( comment #21 ). You can use it like this:
buildscript {
repositories {
maven {
url 'http://storage.googleapis.com/r8-releases/raw '
}
}
dependencies {
classpath 'com.android.tools:r8:1.4.94' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0' // Your current AGP version.
}
}
If it still gives you NPE ( comment #17 ), the fix for that (https://r8-review.googlesource.com/c/r8/+/37762 ) is landed in master. You can use it like this:
buildscript {
repositories {
maven {
url "http://storage.googleapis.com/r8-releases/raw/master "
}
}
dependencies {
classpath 'com.android.tools:r8:96c99992d20194ccee2ebcee6a6c53787f37b34f' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.5.0-alpha13'
}
}
It'd really appreciated if you can try both actually. :)
buildscript {
repositories {
maven {
url '
}
}
dependencies {
classpath 'com.android.tools:r8:1.4.94' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0' // Your current AGP version.
}
}
If it still gives you NPE (
buildscript {
repositories {
maven {
url "
}
}
dependencies {
classpath 'com.android.tools:r8:96c99992d20194ccee2ebcee6a6c53787f37b34f' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.5.0-alpha13'
}
}
It'd really appreciated if you can try both actually. :)
su...@gmail.com <su...@gmail.com> #24
"com.android.tools:r8:1.4.94" works for me. I am not seeing the build failures anymore. And also I don't see the NPE anymore.
Thanks
Thanks
js...@google.com <js...@google.com> #25
Thank you for the confirmation! You can stick to 1.4 until AS 3.5 beta2. Thanks!
Description
<init>();
}` uses extends but actually matches implements.
> Task :App:transformClassesAndResourcesWithR8ForRelease
D8: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.
> Task :App:transformClassesAndResourcesWithR8ForRelease FAILED
:App:transformClassesAndResourcesWithR8ForRelease (Thread[Execution worker for ':',5,main]) completed. Took 20.131 secs.
AAPT2 aapt2-3.4.0-5326820-osx Daemon #0: shutdown
AAPT2 aapt2-3.4.0-5326820-osx Daemon #1: shutdown
AAPT2 aapt2-3.4.0-5326820-osx Daemon #2: shutdown
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':App:transformClassesAndResourcesWithR8ForRelease'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete