Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic 3: black screen with Android App on device

Yesterday, I built and run my app on my Android device and this version worked fine.

Since, I improved my app (content view and controller of some modules) and today, I have a black screen on device.

Tests where app is OK

  • When I execute ionic serve
  • When I build another Ionic app (not this one) and run on device

Tests where app fails on device

  • When I execute ionic cordova run android --debug
  • When I use the same version like yesterday
  • When I try to rebuild a already tagged version (So qualified and tested)

I think that maybe my build configuration is corrupted but I don't know how.

I tried to:

  • remove and re-add Android platform
  • re-install all NPM modules

but nothing these steps does not fix the issue.

On device, I can't access to "Inspect device" tool of Chrome to see if I have JS problem.

Do you have any idea to resolve my problem please?

EDIT

After more tests, I found the following behavior:

If I change the ID of <widget id="new-app-id"> in config.xml, app runs fine on device!

Any idea on this behavior?

Thanks!

like image 699
clem Avatar asked Aug 31 '18 16:08

clem


People also ask

How do I test my Ionic app on Android?

To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.

How do you debug an Ionic app on Android emulator?

Developer Options & USB Debugging are enabled by default in the Android emulator. Open the Chrome browser and navigate to the URL chrome://inspect/#devices . Your connected Android device should show up in the list of Remote Targets. On your device, open the Ionic app that you would like to debug using Chrome.

Do I need Android studio for Ionic?

We don't recommend using Android Studio for developing Ionic apps. Instead, it should only really be used to build and run your apps for the native Android platform and to manage the Android SDK and virtual devices.


1 Answers

After many tests and research, I found the root cause and can solve the issue.

Solution

Remove the plugin cordova-plugin-facebook4 and re-add it with SDK VERSION to 4.35.0 For older cordova-android version, the version shall be defined as described here

So, run:

ionic cordova plugin remove cordova-plugin-facebook4
ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="<APP-ID>" --variable APP_NAME="<APP-NAME>" --variable ANDROID_SDK_VERSION="4.35.0"

Root cause

As decribed in this post, Facebook SDK version 4.36.0 is not stable and causes the stuck in main thread.

This behavior is visible on my App (with "monitor tools" of Android SDK)

like image 87
clem Avatar answered Oct 21 '22 06:10

clem