question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Fail to run Android project after migrating to Capacitor 4

See original GitHub issue

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.4.0
  @capacitor/core: 4.4.0
  @capacitor/android: 4.4.0
  @capacitor/ios: 4.4.0

Installed Dependencies:

  @capacitor/cli: 4.4.0
  @capacitor/core: 4.4.0
  @capacitor/android: 4.4.0
  @capacitor/ios: 4.4.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

App fails to launch

Expected Behavior

App launches successfully

Other Technical Details

I ran the migration according to https://capacitorjs.com/docs/updating/4-0. Thought that outdated Cordova plugins could be the reason and therefore transitioned all but one to Capacitor plugins, the one remaining is https://github.com/randdusing/cordova-plugin-bluetoothle

npm --version output: 8.19.1

node --version output: 18.8.0

Additional Context

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.pepperlfuchs.wilsen, PID: 30590
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.pepperlfuchs.wilsen/com.pepperlfuchs.wilsen.MainActivity}: java.lang.InstantiationException: java.lang.Class<com.pepperlfuchs.wilsen.MainActivity> has no zero argument constructor
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3914)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8663)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
     Caused by: java.lang.InstantiationException: java.lang.Class<com.pepperlfuchs.wilsen.MainActivity> has no zero argument constructor
        at java.lang.Class.newInstance(Native Method)
        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1273)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3901)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:226) 
        at android.os.Looper.loop(Looper.java:313) 
        at android.app.ActivityThread.main(ActivityThread.java:8663) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, Nov 3, 2022

glad you figured out

willgardner9, can you create a new issue and provide a sample app where your issue can be reproduced? I’m closing this one since NunoSav solved their issue.

0reactions
ionitron-bot[bot]commented, Dec 3, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Android Issues | Capacitor Documentation
This error is often due to Gradle needing to be synced, something you'll need to do periodically after updating dependencies and changing project...
Read more >
Cannot finish Capacitor 4 migration due to build error
There was a bug on the migrate command that has been fixed but not released yet that causes the variables.gradle to be broken...
Read more >
android studio is not working using ionic capacitor
I am using ionic framework capacitor for android development. ... But It is showing the following error: Migrate Project to Gradle?
Read more >
Upgrading your build from Gradle 6.x to the latest
For migrating from Gradle 4.x or 5.x, see the older migration guide first. ... afterEvaluate() after project evaluation is now an error.
Read more >
Troubleshoot known issues with Android Emulator
Check for adequate disk space · Antivirus software · HAXM on unsupported versions of macOS · Android Emulator runs slowly after an update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found