React-Native 關於oppo手機閃退的問題

剛剛學習React-Native,感謝前人挖井,今天有一點本身的收穫,寫下來回報社會;java

1.oppo手機安裝應用閃退,

異常日誌:react

RuntimeException: Unable to instantiate application xxx.xxx.xxx.MainApplication: java.lang.ClassNotFoundException: Didn't find class "xxx.xxx.xxx.MainApplication" on path: DexPathList[[zip file "/data/app/com.yuanda.stock-jmjLVQsrUk6UqNH-lcohtg==/base.apk"],nativeLibraryDirectories=[/data/app/xxx.xxx.xxx-jmjLVQsrUk6UqNH-lcohtg==/lib/arm, /system/fake-libs, /data/app/xxx.xxx.xxx-jmjLVQsrUk6UqNH-lcohtg==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] 複製代碼

此問題的解決方案:android

真機搖晃後調出的調試菜單以下(此截圖爲ios,android相似)

異常日誌以下:ios

android.view.WindowManager$BadTokenException:

Unable to add window android.view.ColorViewRootImplHooks$ColorW@c1e5853 -- permission denied for window type 2003
        at android.view.ViewRootImpl.setView(ViewRootImpl.java:940)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:385)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
        at android.app.Dialog.show(Dialog.java:388)
        at com.facebook.react.devsupport.DevSupportManagerImpl.showDevOptionsDialog(DevSupportManagerImpl.java:477)
        at com.facebook.react.devsupport.DevSupportManagerImpl$1.onShake(DevSupportManagerImpl.java:202)
        at com.facebook.react.common.ShakeDetector.maybeDispatchShake(ShakeDetector.java:146)
        at com.facebook.react.common.ShakeDetector.onSensorChanged(ShakeDetector.java:114)
複製代碼

解決方案:此問題爲權限問題,由於8.0後權限api的變動致使,原來api則無效api

方案1:bash

修改build.gradle中的 targetSdkVersion 23;app

targetSdkVersion 23是一個神奇的版本,這個版本不須要動態申請權限學習

方案2:gradle

借鑑"簡書"javanHuang的<<Android8.0通知欄和懸浮窗新改動>>ui

www.jianshu.com/p/1649c2bd2…

最後祝你們工做順利,生活愉快,第一次寫博客,若有不對之處你們多多指正,共同進步;

做者:小虎灬灬 來源:CSDN 原文:blog.csdn.net/qq_24971275… 版權聲明:本文爲博主原創文章,轉載請附上博文連接!

相關文章
相關標籤/搜索