`cap run android` blank screen, "Cannot read property 'triggerEvent' of undefined"

When running the app through Capacitors live reload, the app does not work at all, not on emulators and not on real devices. The splash screen appears, but is never dismissed, and the inspector console has the error:
Cannot read property 'triggerEvent' of undefined.

I have tried adding android:usesCleartextTraffic="true" to AndroidManifest.xml, but no luck.

When building and running in Android Studio, the app works as normal.

Has anyone seen this before and know how to resolve it?

Bro same is happening here too!!:pensive:
If you got any solution then do share🥲

To elaborate, I’m running the command

ionic capacitor serve android -l

This has never worked, over multiple versions of Ionic and Capacitor, or different versions of Android. Works fine on iOS, but Android it doesn’t seem to work at all.

Running a pretty standard Mac setup.

Have you tried the steps outlined here?

Here are a few things you could try:

  1. Make sure the plugin is installed and appears in the package.json file.

  2. Run npx cap sync android to sync your project.

  3. Use the “Sync Project with Gradle Files” button in Android Studio. This will re-sync your native Android code to include the new plugin code and should allow use of your new plugin. source (Troubleshooting Android Issues | Capacitor Documentation)

Thanks – I have tried your suggestions in both the troubleshooting guide and your list, but no success, unfortunately.

I had the same issue after upgrading to ionic 6 and it was due to gradle.

So i perform :
npm install
ionic build
npx cap sync (if needed)
ionic capacitor run android -l --external

If issue happen restart the gradle/ restart the pc.
Make sure mobile is connected on same wifi as PC.

This issue still persists with Ionic CLI 7.1.1, native-run 2.0.0, Capacitor Android 5.5.1, same error message as always. Is there no way to fix this, Ionic?

Can you send the project information and java version also ?

ionic info

Hi! I submitted a bug report on the Capacitor repo, and we managed to find and fix the issue!

1 Like