onionshare / onionshare-android

Android version of OnionShare
https://onionshare.org/
GNU General Public License v3.0
141 stars 16 forks source link

NoClassDefFoundError: pebble.extension.ExtensionRegistryFactory (SDK 23) #80

Closed grote closed 8 months ago

grote commented 1 year ago

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 9 months ago

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

grote commented 8 months ago

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

akwizgran commented 8 months ago

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 8 months ago

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

akwizgran commented 8 months ago

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

grote commented 8 months ago

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.

akwizgran commented 8 months ago

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 623023eaf3d4e490b14925725c82a8a170d556c9, which is between 0.1.9 and 0.1.10).

akwizgran commented 8 months ago

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