RuntimeException : 응용 프로그램을 인스턴스화 할 수 없습니다.
내 응용 프로그램을 실행할 때마다 logcat에서 아래 예외가 발생합니다.
04-14 09:29:53.965: W/dalvikvm(1020): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-14 09:29:53.985: E/AndroidRuntime(1020): FATAL EXCEPTION: main
04-14 09:29:53.985: E/AndroidRuntime(1020): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.os.Looper.loop(Looper.java:137)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-14 09:29:53.985: E/AndroidRuntime(1020): at java.lang.reflect.Method.invokeNative(Native Method)
04-14 09:29:53.985: E/AndroidRuntime(1020): at java.lang.reflect.Method.invoke(Method.java:511)
04-14 09:29:53.985: E/AndroidRuntime(1020): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-14 09:29:53.985: E/AndroidRuntime(1020): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-14 09:29:53.985: E/AndroidRuntime(1020): at dalvik.system.NativeStart.main(Native Method)
04-14 09:29:53.985: E/AndroidRuntime(1020): Caused by: java.lang.NullPointerException
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
04-14 09:29:53.985: E/AndroidRuntime(1020): at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
04-14 09:29:53.985: E/AndroidRuntime(1020): ... 11 more
참고 : 에뮬레이터에서 앱을 제거하고 실행하면이 예외가 발생하지 않지만 에뮬레이터에서 설치된 애플리케이션을 다시 실행하면이 문제가 발생합니다. 도와주세요.
이것은 dalvik이 .apk 파일을 다시 설치하고 동일한 패키지에서 이전에 열었던 활동 /보기를 재사용하거나 재활용하려고 할 때 기본 프레임 워크에서 발생하는 자세한 오류 메시지입니다 (이전에 설치된 앱을 아직 닫지 않은 경우). 또한 앱과 관련이 없으며 최종 사용자 장치의이 장황한 오류 메시지로 인해 앱이 중단되거나 충돌 할 가능성이 거의 없습니다.
이 dalvik verbose 오류 로그는 Android 4.0 시스템에서만 발생한 것으로 보이며 Android 3.2 및 2.3.3 실행 환경에서 직접 테스트했습니다.이 메시지를 둘 다 표시하기 위해 복제 할 수 없습니다. 유사한 질문이 여기 에서 이전에 논의 되었으며 누군가 Android Issues Tracker 에서 버그 보고서를 작성했습니다 .
지금은이 장황한 오류 로그에 대해 너무 걱정할 필요가 없다고 생각합니다. Logcat에서이 빨간색 오류 전후에 더 많은 로그를 살펴보면 전체 스토리를 볼 수 있고 이전에 열린 활동 /보기 (이 사망 상태로 표시됨) 사망하고 새로 다시 설치된 항목이 궁극적으로 팝업됩니다.
I realise it's a very old question, but this may be useful anyway. I've found that when I observe this error in my own development, it's due to the previously running instance of my app not closing down neatly, for example by shutting down background threads prior to exit.
I have been getting same error when I tried connect to the internet with JSOUP inside my application class. It was tricky, because application run on emulator but not on actual device. It turned out, that I just used JSOUP library wrong. Loading page in new thread solved my problem.
Hope I helped someone.
Hope this helps someone. Go to the running apps on your emulator by clicking this:
Close the app you are trying to install and then run it again. NO need to uninstall/reinstall app or clean project.
For me it helped to clean the Project. In Eclipse:
- Project --> Clean
Please control that Project --> Build Automatically is CHECKED
If the gen-Folder is empty after that, there's a mistake in the res-folder. Often, mistakes in the res-folder aren't shown by the red cross! Good luck and greetings
In my case this error appear after I've imported Android Maven project into new workspace, and SRC folder was not automatically added to build path.
Right click on the project/Build path/Configure build path/Source - check if there missing sources.
I got the same problem. Cleaning the project worked for me.
Select project go to Project --> Clean
In my case logcat show me it coudn't find the initial activity, but the Dex Path was different, it was ".../data/app/myapp-1" instead of ".../data/app/myapp". I soved this making click on the elcipse project name "myapp" in the Package explorer window. Then right click on it, ->refactor->rename... I set the project name to myapp-1, and then, ->refactor->rename... and back again to "myapp". Then it worked... some kinf of bug in eclipse?
I got the same problem. Uninstalling my app then reinstalling it solved the issue.
I experienced this when I imported my project which was built from a different machine. Just Invalidate caches and restart
File>Invalidate Caches/Restart>Invalidate and restart
I changed the applicationId to something different on (Module:app) build.gradle file, run the app again on my device. Then, I undo the change and run the app again and everything works. It works on Android Studio 2.3.1 and 4 different devices I have here, from 5.0 to 7.0.
I meet this question. When use gradle clean
,gradle installDebug
it work ok!
AndroidRuntime D Shutting down VM
E FATAL EXCEPTION: main
E Process: tv.panda.live.broadcast, PID: 4685
E java.lang.RuntimeException: Unable to instantiate application tv.panda.live.broadcast.PandaApplication: java.lang.ClassNotFoundException: Didn't find class "tv.panda.live.broadcast.PandaApplication" o
n path: DexPathList[[zip file "/data/app/tv.panda.live.broadcast-1/base.apk"],nativeLibraryDirectories=[/data/app/tv.panda.live.broadcast-1/lib/arm, /vendor/lib, /system/lib]]
E at android.app.LoadedApk.makeApplication(LoadedApk.java:572)
E at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4883)
E at android.app.ActivityThread.access$1500(ActivityThread.java:178)
E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
E at android.os.Handler.dispatchMessage(Handler.java:111)
E at android.os.Looper.loop(Looper.java:194)
E at android.app.ActivityThread.main(ActivityThread.java:5691)
E at java.lang.reflect.Method.invoke(Native Method)
E at java.lang.reflect.Method.invoke(Method.java:372)
E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
E Caused by: java.lang.ClassNotFoundException: Didn't find class "tv.panda.live.broadcast.PandaApplication" on path: DexPathList[[zip file "/data/app/tv.panda.live.broadcast-1/base.apk"],nativeLibraryDi
rectories=[/data/app/tv.panda.live.broadcast-1/lib/arm, /vendor/lib, /system/lib]]
E at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E at android.app.Instrumentation.newApplication(Instrumentation.java:988)
E at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
E ... 10 more
E Suppressed: java.lang.ClassNotFoundException: tv.panda.live.broadcast.PandaApplication
E at java.lang.Class.classForName(Native Method)
E at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E ... 13 more
E Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
참고URL : https://stackoverflow.com/questions/10150899/runtimeexception-unable-to-instantiate-application
'Programing' 카테고리의 다른 글
함수에서 조기 반환의 효율성 (0) | 2020.08.25 |
---|---|
AngularJs에서 동적 범위 변수 설정-범위. (0) | 2020.08.25 |
int가 null인지 확인하는 방법 (0) | 2020.08.25 |
디렉티브 테스트에서 $ apply 대 $ digest (0) | 2020.08.25 |
Conda가 기본 환경을 기본적으로 활성화하지 못하도록하려면 어떻게해야합니까? (0) | 2020.08.25 |