Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Some related mappings.
io.fabric.sdk.android.services.common.ExecutorUtils -> d.a.a.a.a.b.x:
...
958:958:java.lang.Object kotlin.jvm.internal.TypeIntrinsics.beforeCheckcastToFunctionOfArity(java.lang.Object,int):341 -> a
959:959:java.lang.Object kotlin.jvm.internal.TypeIntrinsics.beforeCheckcastToFunctionOfArity(java.lang.Object,int):342:342 -> a
...
20:20:void kotlin.jvm.internal.TypeIntrinsics.throwCce(java.lang.String):26:26 -> b
20:20:void kotlin.jvm.internal.TypeIntrinsics.throwCce(java.lang.Object,java.lang.String):22 -> b
which means, this line:https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/TypeIntrinsics.java#L342 is inlined to io.fabric's report generating routine.
io.fabric.sdk.android.services.common.ExecutorUtils -> d.a.a.a.a.b.x:
...
958:958:java.lang.Object kotlin.jvm.internal.TypeIntrinsics.beforeCheckcastToFunctionOfArity(java.lang.Object,int):341 -> a
959:959:java.lang.Object kotlin.jvm.internal.TypeIntrinsics.beforeCheckcastToFunctionOfArity(java.lang.Object,int):342:342 -> a
...
20:20:void kotlin.jvm.internal.TypeIntrinsics.throwCce(java.lang.String):26:26 -> b
20:20:void kotlin.jvm.internal.TypeIntrinsics.throwCce(java.lang.Object,java.lang.String):22 -> b
which means, this line:
[Deleted User] <[Deleted User]> #3
For the record.
Same result with R8 1.5.33
I tested to fully remove Crashlytics + fabric and same crash occurs but of course with different inlining:
Caused by: java.lang.ClassCastException: ta cannot be cast to kotlin.jvm.functions.Function1
at e.f.b.k.b(Intrinsics.java:5)
at e.f.b.k.a(Intrinsics.java:1034)
at c.f.a.c.b.a.b.f.a(EventBus.kt:12)
at k.a.a.a.l.l.onResume(BaseMenuActivity.kt:44)
at xxxxxxxStartActivity.onResume(StartActivity.kt:1)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1413)
at android.app.Activity.performResume(Activity.java:7292)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3803)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3843)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
kotlin.jvm.internal.Intrinsics -> e.f.b.k:
But this one have a million lines after mapping to -> a and -> b
New APK and mapping sent to Jinseong.
Same result with R8 1.5.33
I tested to fully remove Crashlytics + fabric and same crash occurs but of course with different inlining:
Caused by: java.lang.ClassCastException: ta cannot be cast to kotlin.jvm.functions.Function1
at e.f.b.k.b(Intrinsics.java:5)
at e.f.b.k.a(Intrinsics.java:1034)
at c.f.a.c.b.a.b.f.a(EventBus.kt:12)
at k.a.a.a.l.l.onResume(BaseMenuActivity.kt:44)
at xxxxxxxStartActivity.onResume(StartActivity.kt:1)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1413)
at android.app.Activity.performResume(Activity.java:7292)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3803)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3843)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
kotlin.jvm.internal.Intrinsics -> e.f.b.k:
But this one have a million lines after mapping to -> a and -> b
New APK and mapping sent to Jinseong.
uc...@google.com <uc...@google.com> #4
As far as I understand the issue so far, when we merge Kotlin's FunctionX instances into a lambda group, we define it as a sub class of kotlin Lambda and call its constructor with a proper arity. For example, that `ta` is collecting mergeable instances of Function1, which literally inputs one argument and has a lambda function, invoke(Object). The issue is, in the generated lambda group <init>, I saw that arity is set as 0, not 1. Then, before hitting the direct type match (https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/TypeIntrinsics.java#L264 ), it's matched with FunctionBase (a subtype of Lambda) first, and tried to retrieve the arity, where now at runtime that merged group returned a wrong arity. Manually over-writing that arity to the correct one made that type free from casting exceptions. (There are more lambda groups with wrong arities, so the report saw a similar cast exception with a different type.)
It's quite not trivial to reproduce the issue locally. To understand where such arity can go wrong, I add some logging (to R8 1.5). Also, instead of using the size of parameters of the representative method (which could be altered, e.g., via unused argument removal), I change it to use the arity from Kotlin FunctionX interface name directly. See the attached diff.txt.
Tolriq, could you try the attached r8.jar? For logging messages, you can email it to me. Also, hope the resulting apk doesn't crash at runtime. And if so, that would be the potential fix, but I still want to reproduce the issue locally. Thanks!
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
It's quite not trivial to reproduce the issue locally. To understand where such arity can go wrong, I add some logging (to R8 1.5). Also, instead of using the size of parameters of the representative method (which could be altered, e.g., via unused argument removal), I change it to use the arity from Kotlin FunctionX interface name directly. See the attached diff.txt.
Tolriq, could you try the attached r8.jar? For logging messages, you can email it to me. Also, hope the resulting apk doesn't crash at runtime. And if so, that would be the potential fix, but I still want to reproduce the issue locally. Thanks!
buildscript {
dependencies {
classpath files($PATH_TO_R8_JAR) // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
st...@gmail.com <st...@gmail.com> #5
Oops, the jar attached at comment #4 has been built from ToT (1.6.2-dev). Please try this one (or both :D)
sa...@peilicke.de <sa...@peilicke.de> #6
I doubt anyone work on Week-End but quickly tested with the 1.5 version and now have strange crash instead of previous one:)
2019-05-25 11:14:11.115 29479-29577/? E/AndroidRuntime: FATAL EXCEPTION: AppUpdateService
java.lang.AbstractMethodError: abstract method "void b4.h.a.e.a.c.l.a()"
at b4.h.a.e.a.c.l.run(Unknown Source:0)
at android.os.Handler.handleCallback(Handler.java:874)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:198)
at android.os.HandlerThread.run(HandlerThread.java:65)
Will do complete tests and send logs later today.
2019-05-25 11:14:11.115 29479-29577/? E/AndroidRuntime: FATAL EXCEPTION: AppUpdateService
java.lang.AbstractMethodError: abstract method "void b4.h.a.e.a.c.l.a()"
at b4.h.a.e.a.c.l.run(Unknown Source:0)
at android.os.Handler.handleCallback(Handler.java:874)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:198)
at android.os.HandlerThread.run(HandlerThread.java:65)
Will do complete tests and send logs later today.
an...@gmail.com <an...@gmail.com> #7
After reading correctly the error I tried again at same perimeter as before and it actually fix the issue.
This last crash is a new R8 issue tied to implementation("com.google.android.play:core:1.6.0") I have not yet fully implemented it and have not tested with r8 1.4 so will open another issue when I have more details about it.
This last crash is a new R8 issue tied to implementation("com.google.android.play:core:1.6.0") I have not yet fully implemented it and have not tested with r8 1.4 so will open another issue when I have more details about it.
f....@gmail.com <f....@gmail.com> #8
Thank you for logging as well as code snippet. It's really helpful to reproduce the issue (in a different way): https://r8-review.googlesource.com/c/r8/+/38840 (I'm glad I didn't reveal any code patterns from your app!)
Also, thank you for filing a separate issue ( issue 133686361 ) for comment #6 (and comment #7 ). Will take a look at that too.
According to my repro, the issue still exists on master. Could you confirm that it's indeed the case? Here is the build.gradle setting to use the current ToT:
buildscript {
repositories {
maven {
url "http://storage.googleapis.com/r8-releases/raw/master "
}
}
dependencies {
classpath 'com.android.tools:r8:3682ef4d0842a4963e703f8a81035fb67866bdd6' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
------
Regarding the fix, it's also glad to hear that my temporary workaround, included in the patch at comment #4 , works for you. Later, however, I realized that such pattern matching might be prone to several other issues, like literally missed pattern matching, or arithmetic conversion error. So, I came up with another solution: https://r8-review.googlesource.com/c/r8/+/38900 Could you try it while it's under review? Here is another build.gradle setting to use that tentative fix:
buildscript {
repositories {
maven {
url "http://storage.googleapis.com/r8-releases/raw/master "
}
}
dependencies {
classpath 'com.android.tools:r8:cef9babcb08fc6281bfb115836e7f4c7391fc878' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
(Of course, you may still see issue 133686361 .)
Also, thank you for filing a separate issue (
According to my repro, the issue still exists on master. Could you confirm that it's indeed the case? Here is the build.gradle setting to use the current ToT:
buildscript {
repositories {
maven {
url "
}
}
dependencies {
classpath 'com.android.tools:r8:3682ef4d0842a4963e703f8a81035fb67866bdd6' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
------
Regarding the fix, it's also glad to hear that my temporary workaround, included in the patch at
buildscript {
repositories {
maven {
url "
}
}
dependencies {
classpath 'com.android.tools:r8:cef9babcb08fc6281bfb115836e7f4c7391fc878' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
(Of course, you may still see
da...@digitaspixelpark.com <da...@digitaspixelpark.com> #9
In case you do not already sleep :)
Tested very quickly 3682ef4d0842a4963e703f8a81035fb67866bdd6
And new fix causes new error
java.lang.VerifyError: Verifier rejected class z3.c.b.a.a: void z3.c.b.a.a.a(java.lang.StringBuilder, java.lang.String, java.lang.String, z3.f.a.c.c.o, java.lang.Object) failed to verify: void z3.c.b.a.a.a(java.lang.StringBuilder, java.lang.String, java.lang.String, z3.f.a.c.c.o, java.lang.Object): [0xA] register v4 has type Reference: java.lang.Object but expected Precise Reference: java.lang.String (declaration of 'z3.c.b.a.a' appears in base.apk)
at z3.c.b.a.a.a(Unknown Source:0)
at z3.d.a.w.o.t.<init>(DecodePath.java:6)
at z3.d.a.z.d.<clinit>(LoadPathCache.java:2)
at z3.d.a.n.<init>(Registry.java:3)
at z3.d.a.c.<init>(Glide.java:14)
at z3.d.a.c.b(Glide.java:82)
at z3.d.a.c.a(Glide.java:13)
at org.leetzone.android.yatsewidget.YatseApplication.onCreate(YatseApplication.kt:18)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5918)
at android.app.ActivityThread.access$1100(ActivityThread.java:202)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1665)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
Have to move but will send all APK / mapping for both later today.
Tested very quickly 3682ef4d0842a4963e703f8a81035fb67866bdd6
And new fix causes new error
java.lang.VerifyError: Verifier rejected class z3.c.b.a.a: void z3.c.b.a.a.a(java.lang.StringBuilder, java.lang.String, java.lang.String, z3.f.a.c.c.o, java.lang.Object) failed to verify: void z3.c.b.a.a.a(java.lang.StringBuilder, java.lang.String, java.lang.String, z3.f.a.c.c.o, java.lang.Object): [0xA] register v4 has type Reference: java.lang.Object but expected Precise Reference: java.lang.String (declaration of 'z3.c.b.a.a' appears in base.apk)
at z3.c.b.a.a.a(Unknown Source:0)
at z3.d.a.w.o.t.<init>(DecodePath.java:6)
at z3.d.a.z.d.<clinit>(LoadPathCache.java:2)
at z3.d.a.n.<init>(Registry.java:3)
at z3.d.a.c.<init>(Glide.java:14)
at z3.d.a.c.b(Glide.java:82)
at z3.d.a.c.a(Glide.java:13)
at org.leetzone.android.yatsewidget.YatseApplication.onCreate(YatseApplication.kt:18)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5918)
at android.app.ActivityThread.access$1100(ActivityThread.java:202)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1665)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
Have to move but will send all APK / mapping for both later today.
yo...@gmail.com <yo...@gmail.com> #10
Nah, it turned out ToT has a regression, which has been reverted. Let me quickly prepare a patch on R8 1.5 instead.
jb...@google.com <jb...@google.com> #11
Please try the attached r8.jar on R8 1.5
Description
This happens regardless of operating system - macOS, Linux, or Windows. The underlying reason is that Java 11 omits XML parsers from the core Java distribution - this library was omitted Java 8. Since SDK Manager uses these XML parsers but cannot find them on Java 11, the program throws an exception and crashes.
It is however possible to get SDK Manager running under Java 11 with a workaround. For this one needs to 1) download a handful of dependencies no longer included in Java (jaxb-api, jaxb-impl, jaxb-core, jaxb-jxc, jaxb-xjc, and finally JAF activation 2) modify the sdkmanager shell or BAT script to include these jar files in the classpath. This is described in
Needless to say, this is a suboptimal user experience. Moreover, Oracle's end-of-support for public Java 8 (security) updates at the end of this month will have many people looking to upgrade to OpenJDK 11. As Java 9 and 10 are already at out of support, Java 11 through OpenJDK builds is the straightforward freely available option for security updates. As it currently stands, this version of Java is not supported by the SDK Manager.
Can the required dependencies be included in the build tools lib directory, so that SDK Manager can run when using Java 11?