onionshare/onionshare-android

NoClassDefFoundError: pebble.extension.ExtensionRegistryFactory (SDK 23)

grote opened this issue · 8 comments

grote commented

ZTE martell (Stack) Android 6.0 (SDK 23)

Exception java.lang.NoClassDefFoundError:
  at com.mitchellbosecke.pebble.extension.ExtensionRegistryFactory.<init> (ExtensionRegistryFactory.java:26)
  at com.mitchellbosecke.pebble.PebbleEngine$Builder.<init> (PebbleEngine.java:301)
  at io.ktor.server.pebble.PebbleConfiguration.<init> (Pebble.kt:20)
  at io.ktor.server.pebble.PebbleKt$Pebble$1.invoke (Pebble.kt:51)
  at io.ktor.server.application.CreatePluginUtilsKt.createPluginInstance (CreatePluginUtilsKt.java:261)
  at io.ktor.server.application.CreatePluginUtilsKt.access$createPluginInstance (CreatePluginUtilsKt.java:1)
  at io.ktor.server.application.CreatePluginUtilsKt$createApplicationPlugin$2.install (CreatePluginUtils.kt:90)
  at io.ktor.server.application.CreatePluginUtilsKt$createApplicationPlugin$2.install (CreatePluginUtils.kt:83)
  at io.ktor.server.application.ApplicationPluginKt.install (ApplicationPlugin.kt:98)
  at org.onionshare.android.server.WebserverManager$start$2.invoke (WebserverManager.kt:69)
  at org.onionshare.android.server.WebserverManager$start$2.invoke (WebserverManager.kt:64)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke (ApplicationEngineEnvironmentReloading.kt:320)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading$instantiateAndConfigureApplication$1.invoke (ApplicationEngineEnvironmentReloading.kt:309)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.avoidingDoubleStartup (ApplicationEngineEnvironmentReloading.kt:337)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.instantiateAndConfigureApplication (ApplicationEngineEnvironmentReloading.kt:309)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.createApplication (ApplicationEngineEnvironmentReloading.kt:150)
  at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.start (ApplicationEngineEnvironmentReloading.kt:276)
  at io.ktor.server.netty.NettyApplicationEngine.start (NettyApplicationEngine.kt:212)
  at io.ktor.server.netty.NettyApplicationEngine.start (NettyApplicationEngine.kt:30)
  at io.ktor.server.engine.ApplicationEngine$DefaultImpls.start$default (ApplicationEngine.java:68)
  at org.onionshare.android.server.WebserverManager.start (WebserverManager.kt:78)
  at org.onionshare.android.ShareManager$shareState$1.invokeSuspend (ShareManager.kt:82)
  at org.onionshare.android.ShareManager$shareState$1.invoke (ShareManager.kt)
  at org.onionshare.android.ShareManager$shareState$1.invoke (ShareManager.kt)
  at kotlinx.coroutines.flow.FlowKt__ZipKt$combineTransform$$inlined$combineTransformUnsafe$FlowKt__ZipKt$4$1.invokeSuspend (Zip.kt:333)
  at kotlinx.coroutines.flow.FlowKt__ZipKt$combineTransform$$inlined$combineTransformUnsafe$FlowKt__ZipKt$4$1.invoke (Zip.kt)
  at kotlinx.coroutines.flow.internal.CombineKt$combineInternal$2.invokeSuspend (Combine.kt:79)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.java:570)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:750)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:677)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:664)
Caused by java.lang.ClassNotFoundException:
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:511)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:469)
grote commented

We should test on Android 6.0 (SDK 23). Maybe it is a Java 6 issue?

grote commented

@akwizgran do you have an Android 5/6 device to test this?

I can't reproduce this on the Moto E3 (API 23) with a debug or release build.

The stacktrace rings a bell - I think we might have seen this crash with Briar Mailbox, although I can't find a ticket for it. I wonder if it was a ProGuard issue resolved by #101?

grote commented

We could check this by testing an earlier commit before this fix.

Do you know what version of the app the crash came from?

grote commented

No and Google Play doesn't have it anymore as it never happened again. Judging from the issue date it must have been https://github.com/onionshare/onionshare-android/releases/tag/0.1.9 or earlier.

I can reproduce this on the Moto E3 with 0.1.9 but not with 0.1.10. The exception message (missing from what Google Play gives us) is java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/function/Function;, which suggests that enabling library desugaring fixed the crash (commit 623023e, which is between 0.1.9 and 0.1.10).

OK, this is why the stack trace rang a bell. 🤦