Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Android App crashing after adding this plugin #30

Open
Harshida-ck opened this issue Nov 1, 2024 · 5 comments
Open

[Bug] Android App crashing after adding this plugin #30

Harshida-ck opened this issue Nov 1, 2024 · 5 comments

Comments

@Harshida-ck
Copy link

Harshida-ck commented Nov 1, 2024

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

@patforg
Copy link

patforg commented Nov 8, 2024

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)

@patforg
Copy link

patforg commented Nov 11, 2024

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

@sm3sher
Copy link

sm3sher commented Nov 25, 2024

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.

@MarcelSchuermann
Copy link

MarcelSchuermann commented Nov 28, 2024

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:

  • gradle-8.9-bin.zip
  • JDK 23 (tried with 17 with 8.9 as well and 20 with gradle 8.4)
    -- capacitor
    -- android 6.2.0
    -- core 6.2.0
    -- app 6.0.2
    -- InAppBrowser 1.0.2 (also tried 1.0.1 with gradle 8.4)

@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

@joseagith
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants