Android app fails after update to Android 25.0.0
See original GitHub issueDescription
I updated the android appcompat library version to 25.0.0 because I wanted to use some APIs that were introduced in API level 24. After downloading and installing the required files, when I start the app on either device or Genymotion Simulator, it throws the below exception and the attached screenshot appears on the app screen. So, the app isn’t exactly crashed but I don’t see the app launch screen.
Exception:
10-27 13:45:08.550 7317-7317/com.galarmapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.galarmapp, PID: 7317
android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@c51fa6 -- permission denied for this window type
at android.view.ViewRootImpl.setView(ViewRootImpl.java:591)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.facebook.react.devsupport.DevSupportManagerImpl.handleReloadJS(DevSupportManagerImpl.java:644)
at com.facebook.react.XReactInstanceManagerImpl$3$1.run(XReactInstanceManagerImpl.java:401)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Below screen shows up on the device and the Simulator
By default, the Draw over other apps permissions is set to No for the app. On the device, if I enable the permission and restart the app, it works as expected. On the Simulator, it keeps showing the same screen. Is there a way to allow this permission by default because a user may not know that he has to enable the Draw over other apps permissions.
Reproduction
Update the android appcompat library version by updating the following the android/app/build.gradle
file
buildToolsVersion "25.0.0
compile "com.android.support:appcompat-v7:25.0.0
Add following permissions to the AndroidManifest.xml
file
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
Run the app and observe the specified behavior
Additional Information
- React Native version: 0.34.1
- Platform: Android
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Please set targetSdkVersion to
22
. React Native has compatible issues withtargetSdkVersion 23+
.Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.