1. 程式人生 > >java.lang.RuntimeException: Unable to instantiate application app.dawnling.app.app.MyApplication: ja

java.lang.RuntimeException: Unable to instantiate application app.dawnling.app.app.MyApplication: ja

Android Studio專案會經常遇到這個錯誤,然後就各種Clean Project和Rebuild Project有時候有用有時候沒用,摸不著頭腦

這裡寫圖片描述

錯誤程式碼如下:

12-18 17:46:01.512 4978-4978/app.dawnling.app E/AndroidRuntime: FATAL EXCEPTION: main
                                                                Process: app.dawnling.app, PID: 4978
                                                                java.lang.RuntimeException: Unable to
instantiate application app.dawnling.app.app.MyApplication: java.lang.ClassNotFoundException: Didn't find class "app.dawnling.app.app.MyApplication" on path: DexPathList[[zip file "/data/app/app.dawnling.app-2/base.apk"],nativeLibraryDirectories=[/data/app/app.dawnling.app-2/lib/x86, /system/lib, /vendor/lib]] at
android.app.LoadedApk.makeApplication(LoadedApk.java:802) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5377) at android.app.ActivityThread.-wrap2(ActivityThread.java) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.lang.ClassNotFoundException: Didn't find class "app.dawnling.app.app.MyApplication" on path: DexPathList[[zip file "/data/app/app.dawnling.app-2/base.apk"],nativeLibraryDirectories=[/data/app/app.dawnling.app-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.Instrumentation.newApplication(Instrumentation.java:992) at android.app.LoadedApk.makeApplication(LoadedApk.java:796) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5377) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

原因猜測:

之所以 Didn’t find class 找不到相關報錯的類,可能是由於類在編譯打包的過程中,沒有全部一起打包上,漏掉了。

解決方法:

1.先刪除專案結構中的 .gradle 資料夾,然後Build->Rebuild Project->Clean Project->Build APK重新執行安裝,即可正常執行

2.如果失敗,請嘗試再次刪除.gradle 和.idea 檔案,重啟 Android Studio ,然後再嘗試。

相關推薦

java.lang.RuntimeException: Unable to instantiate application app.dawnling.app.app.MyApplication: ja

Android Studio專案會經常遇到這個錯誤,然後就各種Clean Project和Rebuild Project有時候有用有時候沒用,摸不著頭腦 錯誤程式碼如下: 12-18 17:46:01.512 4978-4978/app.dawnli

安卓- apk安裝出現閃退java.lang.RuntimeException: Unable to instantiate application

Android Apk安裝出現java.lang.RuntimeException: Unable to instantiate application 08-08 14:50:12.445 29909-29909/? E/AndroidRuntime: FATAL EXCEPTIO

初學者級java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

不多說,看到初學者級就知道,這鬼異常爆出來肯定是沒好好看書導致的。 又花了大半天時間解決了一個奇奇怪怪的問題。 過程就不說了,都是淚。 http://blog.csdn.net/gaohongijj/article/details/8010869/ 這位大神細緻的講解了很多

Android開發中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}

net 控件 view etc spi pos rst ack data Android開發中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullP

用idea+maven編譯打包spark project core錯誤:java.lang.RuntimeException: Unable to load a Suite class

ide exception 5-0 sco anon time arp create run Discovery starting. *** RUN ABORTED *** java.lang.RuntimeException: Unable to load a Su

記錄錯誤:java.lang.RuntimeException: Unable to start activity ComponentInfo

android  activity打不開,具體錯誤如下: 01-02 00:02:25.495 E/AndroidRuntime(  984): FATAL EXCEPTION: main01-02 00:02:25.495 E/AndroidRuntime(  98

安卓解決java.lang.RuntimeException: Unable to get provider com.blankj.utilcode.util.Utils$FileProvider

在其他手機上執行的好好的,換了一個手機執行,直接打不開,報錯: java.lang.RuntimeException: Unable to get provider com.blankj.utilcode.util.Utils$FileProvider4UtilCode: java.lan

Android開發中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi

今天學習Android開發突然遇到了這個問題,查閱了很多資料,並且對集中原因進行了分析。  錯誤資訊字串:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.first/com.f

java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.NullPointerExcept

錯誤提示: java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.NullPointerException 網上有不少解決辦法 一般都會在Activity onC

android 4.4報錯java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvi

在android studio3.0 android 4.4.4 api 19下執行一直報錯如下: java.lang.RuntimeException: Unable to get provider android.support.v4.content.

主activity報空指標異常java.lang.RuntimeException: Unable to resume activity

主activity   報空指標異常 java.lang.RuntimeException: Unable to resume activity {com.click369.test/com.click369.test.jzactivity.TallyToolActivit

Android Studio中的控制元件初始化疑問:build沒問題,但執行模擬器時出現問題。錯誤程式碼:java.lang.RuntimeException: Unable to instant

在使用Android Studio,啟動模擬器時,出現如下錯誤:Logcat中的資訊如下:java.lang.RuntimeException:Unable to instantiate activityComponentInfo{com.example.dcyyw.appl

Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication 解決辦法

and bootstra uil 多次 div cep cat java exce 相信很多人都遇到過這個問題,用Android Studio正在運行程序的時候,突然不知道什麽原因,報一個找不到application或者找不到activity的錯誤(java.lang.Cl

關於“java.lang.OutOfMemoryError : unable to create new native Thread”的報錯問題

ulimit命令 既然 tps spa 好的 tiger src targe new 轉自:https://www.cnblogs.com/flying-tiger/p/5956926.html java.lang.OutOfMemoryError : unable t

執行Android專案 Unable to instantiate application, IllegalAccessException

執行Android專案報如下錯誤 06-08 14:08:52.370 12415-12415/com.dobest E/AndroidRuntime: FATAL EXCEPTION: main Process: com.dobest, PID: 12415 java.lang.Ru

java.lang.IllegalArgumentException: Unable to resolve attribute [its] against path at org.hibernate.

java.lang.IllegalArgumentException: Unable to resolve attribute [its] against path at org.hibernate.ejb.criteria.path.AbstractPathImpl.unknownAttribut

Tomcat空間不足:java.lang.IllegalStateException: Unable to create the directory [/tmp/tomcat.]

今天在伺服器部署專案的時候遇到了專案無法啟動的錯誤,仔細一看異常: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang

亂七八糟問題-java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(class

java.lang.OutOfMemoryError: unable to create new native thread

1,使用 ulimit -a或者ulimit -u查詢當前機器設定的執行緒數 :4096 2,用jstack pid>xxx.txt 3,然後檢視 -Xss的大小,這個一般是制約因素

java.lang.IllegalStateException: Unable to open nested entry 'lib/bsfit-api-1.0.3.jar'. It has been

java.lang.IllegalStateException: Unable to open nested entry 'lib/bsfit-api-1.0.3.jar'.  It has been compressed and nested jar files must