Open Harshida-ck opened 4 weeks ago
Getting the same problem...
Install via yarn add @capacitor/inappbrowser
When I try and launch my application I get this exception
FATAL EXCEPTION: main
Process: com.example.app, PID: 6677
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
at android.app.ActivityThread.installProvider(ActivityThread.java:7770)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2619)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2589)
at android.app.ActivityThread.installProvider(ActivityThread.java:7765)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:173)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2619)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2589)
at android.app.ActivityThread.installProvider(ActivityThread.java:7765)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:37)
at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:25)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:173)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2619)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2589)
at android.app.ActivityThread.installProvider(ActivityThread.java:7765)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ReportFragment$ActivityInitializationListener" on path: DexPathList[[zip file "/data/app/~~NLz6pVkxL_BG26CfBYB_3Q==/com.danslescoulisses.app-od1eX8Gb4XCbNwKGnXVSNw==/base.apk"],nativeLibraryDirectories=[/data/app/~~NLz6pVkxL_BG26CfBYB_3Q==/com.danslescoulisses.app-od1eX8Gb4XCbNwKGnXVSNw==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:37)
at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:25)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:173)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2619)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2589)
at android.app.ActivityThread.installProvider(ActivityThread.java:7765)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
I was able to get the plugin working by upgrading to a newer Gradle version
I changed it in the file android\gradle\wrapper\gradle-wrapper.properties
changed the line with distributionUrl
to
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
This change in requiring a newer Gradle version was introduced when upgrading
@capacitor/inappbrowser
from version 1.0.1
to 1.0.2
.
I would have appreciated if this breaking change was clearly mentioned in the release notes.
I have the same issue. Related issue #33 and Ionic post: https://forum.ionicframework.com/t/capacitor-inappbrowser-crashes-app-on-android/245034/3
Edit: It is still not working in my case. Specs:
@patforg, @sm3sher any ideas?
Edit 2: I get following warning now when I execute with -- warning-mode all
Could not determine the dependencies of task ':capacitor-inappbrowser:compileDebugKotlin'.
> Unknown Kotlin JVM target: 23
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from
your own scripts or plugins.
(node:43992) ExperimentalWarning: CommonJS module C:\Users\...\AppData\Roaming\nvm\v23.1.0\node_modules\npm\node_modules\debug\src\node.js is loading ES Module C:\Users\...\AppData\Roaming\nvm\v23.1.0\node_modules\npm\node_modules\supports-color\index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
below steps worked for me 1)In Android studio do the below jdk 17 settings for gradle .if java jdk 17 is not installed then first install jdk 17 in ur machine go to settings -> project structure -> build tools -> gradle -> gradle jdk as select 17 2)Go to upgrade assistant in left corner menu and Update the Android gradle plugin version from 8.2.1 to 8.7.0 and again upgrade 8.7.0 to 8.7.2 3)Go to visual studio and go android folder under gradle\wrapper open the file gradle-wrapper.properties replace the below value
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip 4)Go to build.gradle file replace the dependencies classpath value
classpath 'com.android.tools.build:gradle:8.7.2' 5)build and run it works fine
changed the minsdkVersion from 22 to 26.Build the app and deployed.
After adding this plugin, application crashes while opening.
This is the link of my sample source code: https://github.com/Harshida-ck/Capacitor-Angular-App