Error when building for Android when attempting to initialize the Bridge: "cannot find symbol this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>)"

Hello! The Android version of our mobile app broke due to a Chrome update that rolled out a couple weeks ago. Our app was running a very old version of Capacitor (Capacitor 2), and in order to deploy the fixed build, I have to migrate the project to Capacitor 5 (as well as update any outdated plugins along the way). It’s been quite a journey and I’ve moved through several unsuccessful builds along the way.

On my current iteration, I’m encountering the following error:

> Task :app:compileReleaseJavaWithJavac FAILED
/builds/[...]/android/app/src/main/java/io/ionic/starter/MainActivity.java:16: error: cannot find symbol
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
        ^
  symbol: method init(Bundle,<anonymous ArrayList<Class<? extends Plugin>>>)
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

This error takes place when attempting to initialize the Bridge, according to the surrounding comments in MainActivity.java.

I’ve spent the past week trying to get this app into production without any luck, and I’m hoping that one of you kind people can give me some guidance! :slight_smile:

the init method was deprecated in Capacitor 3 and removed in Capacitor 4

It’s documented on Capacitor 3 upgrade guide as a recommended change

And also on Capacitor 4 upgrade guide as a mandatory change

1 Like

Thank you! That was exactly the fix I needed. There were so many outdated items that I had to migrate from v2 to v3 to v4 to v5 that it’s not surprising that this was missed. The app now compiles for Android, and I just need to deploy the binary to the Play Store.

Thank you again!