mardi 19 juillet 2022

Why a Scala 2.13 app is trying to use `JavaClassValue` on Android if it is not available, then triggering `java.lang.NoClassDefFoundError`?

I'm running a Scala app on Android using https://github.com/dsvdsv/scala-android-plugin and Scala 2.13.8 and I get these weird stack traces on the logs:

07-19 11:46:26.057  3647  3647 I zygote64: Rejecting re-init on previously-failed class java.lang.Class<scala.runtime.ClassValueCompat$JavaClassValue>: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/ClassValue;
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.057  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.057  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.057  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.057  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.057  3647  3647 I zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.ClassValue" on path: DexPathList[[zip file "/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk"],nativeLibraryDirectories=[/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/lib/arm64, /data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.057  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.057  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.057  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.057  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.057  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.057  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.057  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.057  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.057  3647  3647 I zygote64:
07-19 11:46:26.058  3647  3647 I zygote64: Rejecting re-init on previously-failed class java.lang.Class<scala.runtime.ClassValueCompat$JavaClassValue>: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/ClassValue;
07-19 11:46:26.058  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.058  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.058  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.058  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.058  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.058  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.058  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.058  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.058  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.058  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.058  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.058  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.059  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.059  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.059  3647  3647 I zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.ClassValue" on path: DexPathList[[zip file "/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk"],nativeLibraryDirectories=[/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/lib/arm64, /data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
07-19 11:46:26.059  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.059  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.059  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.059  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.059  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.059  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.059  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.059  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.059  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.059  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.059  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.059  3647  3647 I zygote64:
07-19 11:46:26.060  3647  3647 I zygote64: Rejecting re-init on previously-failed class java.lang.Class<scala.runtime.ClassValueCompat$JavaClassValue>: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/ClassValue;
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.060  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.060  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.060  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.060  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.060  3647  3647 I zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.ClassValue" on path: DexPathList[[zip file "/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk"],nativeLibraryDirectories=[/data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/lib/arm64, /data/app/wtf.nbd.obw.dev-hM8iLOxXzgsl9ADHLU7hJA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.reflect.ClassTag scala.reflect.ClassTag$.apply(java.lang.Class) (ClassTag.scala:157)
07-19 11:46:26.060  3647  3647 I zygote64:   at void fr.acinq.eclair.wire.CommonCodecs$.<clinit>() (CommonCodecs.scala:153)
07-19 11:46:26.060  3647  3647 I zygote64:   at void immortan.wire.ExtCodecs$.<clinit>() (ExtCodecs.scala:24)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.collection.immutable.List immortan.sqlite.SQLiteData.$anonfun$tryGetMnemonics$1(scodec.bits.ByteVector) (SQLiteData.scala:54)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object immortan.sqlite.-$$Lambda$tPYNHLDkOzKQyc6N9riH1kDlNaQ.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.util.Try scala.util.Success.map(scala.Function1) (Try.scala:262)
07-19 11:46:26.060  3647  3647 I zygote64:   at scala.util.Try immortan.sqlite.SQLiteData.tryGetMnemonics() (SQLiteData.scala:52)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:60)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.proceed(java.lang.Object) (MainActivity.scala:54)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.MainActivity.$anonfun$onResume$5(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.MainActivity.$anonfun$onResume$5$adapted(wtf.nbd.obw.MainActivity, java.lang.Object) (MainActivity.scala:43)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object wtf.nbd.obw.-$$Lambda$n_HFoagsPQeELoRoOgqfWtzRrXY.apply(java.lang.Object) (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity.$anonfun$runFutureProcessOnUI$2(scala.Function1, java.lang.Object) (BaseActivity.scala:281)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.-$$Lambda$7sLNsOLl1sATbfGX3ztJ04hnydE.apply$mcV$sp() (lambda:-1)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object scala.runtime.java8.JFunction0$mcV$sp.apply() (JFunction0$mcV$sp.scala:18)
07-19 11:46:26.060  3647  3647 I zygote64:   at void wtf.nbd.obw.BaseActivity$$anon$6.run() (BaseActivity.scala:295)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.os.Looper.loop() (Looper.java:169)
07-19 11:46:26.060  3647  3647 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6595)
07-19 11:46:26.060  3647  3647 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-19 11:46:26.060  3647  3647 I zygote64:   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
07-19 11:46:26.060  3647  3647 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
07-19 11:46:26.060  3647  3647 I zygote64:
07-19 11:46:26.543  3647  3653 I zygote64: Do partial code cache collection, code=61KB, data=43KB
07-19 11:46:26.544  3647  3653 I zygote64: After code cache collection, code=61KB, data=43KB
07-19 11:46:26.544  3647  3653 I zygote64: Increasing code cache capacity to 256KB

They happen whenever some code path for some reason touches ClassValue or ClassTag -- which unfortunately happens more often than not inside my dependencies (I've removed everything from my own code and from the dependency usage I could, but that wasn't enough); but weirdly the app doesn't crash, it just runs fine (except it gets a little slow apparently when these errors happen).

Another weird thing is that it seems that it only triggers the error the first time it runs through these code paths (that touch ClassValue), then later the app goes through them many times and the error doesn't happen ever again.

If you look closely it will say it is using ClassValueCompat, which was introduced to fix the lack of java.ClassValue on Android among other things, but then it is not using the FallbackClassValue as it should, it is using JavaClassValue, which was supposed to not exist on Android and is in fact what is causing the error -- so it shouldn't be in use at all.


Notice that ClassValueCompat does this check to determine if it should use JavaClassValue or FallbackClassValue:

private val classValueAvailable: Boolean = try {
  Class.forName("java.lang.ClassValue", false, classOf[Object].getClassLoader)
  true
} catch {
  case _: ClassNotFoundException => false
}

I did this same check on my app initialization code and I got the ClassNotFoundException as expected.





Aucun commentaire:

Enregistrer un commentaire