Black screen on Android 12

Hi guys

Yes I found the solution.

First, you should know how to debug your device because chances are it will not be exactly the same error.

So to debug after you build/install a debug version of your app on an Android 12 Device

BEFORE opening your app use a terminal console software on your PC WITH A SEARCH FUNCTION
I use personally Tilix

  1. Enable USB debug on device
  2. Connect with USB
  3. On PC type: adb devices
  4. Get IN your device with adb shell
  5. Once inside the device: logcat *:E
  6. Then open quickly your app and let it crash with the black screen
  7. A wall of error will show up on the terminal. Use the search function and type the ID of your app like: com.my.app
  8. Then try to pinpoint YOUR errors

For ME, I had 3 problems:

  1. The screen was Black/White/Blank because Ionic Native Storage was out of date. Android Level 30+ uses a new storage system. For me, it was blocking my Authorization Token stored. So gave me a black screen. If you update your package it should work.

  2. My app was still crashing due to Multidex. Here’s the problem/solution: https://forum.ionicframework.com/t/java-lang-runtimeexception-unable-to-instantiate-application-android-hardware-bluetooth/224599

  3. And finally in the logcat if you see android.permission.BLABLABLA like

android.permission.BLUETOOTH_CONNECT
android.permission.BLUETOOTH_SCAN

It’s most likely you’ll need to add permissions in your config.xml
AND IMPORTANT FOR ANDROID API 30+
Android Permissions | Android Device and Ionic App Permissions
It will FORCE an android modal popup a permission modal to allow whatever native function you need. You MUST use this on API 30+

Good luck