By GeekHades


2015-11-28 04:30:16 8 Comments

I updated my Android Studio to version 2.0. But I had a problem, I don't know why?

The important error info:

Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.eallcn.rentagent.MyDebugEallApplication

I searched a long time, But I didn't find the right answer you can see the link

At the same time when I click File->Project structure It shows this error:

enter image description here

Is there any problem somewhere in the libs? When gradle build the program the libs didn't load completely for current program. Is there any problem with Android Studio version 2.0?

When I use Android studio 1.4.0 to build and run the program. It works fine for me! But when I use the Android Studio 2.0, the problem shows up!

Why? Could you help me, please?

Here is detailed error log:

11-28 11:57:00.489 19890-19890/com.eallcn.rentagent.debug E/AndroidRuntime: FATAL EXCEPTION: main Process: com.eallcn.rentagent.debug, PID: 19890 java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.eallcn.rentagent.MyDebugEallApplication at android.app.LoadedApk.makeApplication(LoadedApk.java:537) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586) at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.eallcn.rentagent.MyDebugEallApplication
at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:167) at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179) at android.app.Application.attach(Application.java:194)
at android.app.Instrumentation.newApplication(Instrumentation.java:992)
at android.app.Instrumentation.newApplication(Instrumentation.java:976)
at android.app.LoadedApk.makeApplication(LoadedApk.java:532)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)  at android.app.ActivityThread.access$1800(ActivityThread.java:139)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5314)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.ClassNotFoundException: com.eallcn.rentagent.MyDebugEallApplication at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:251) at java.lang.Class.forName(Class.java:216) at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155) at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)  at android.app.Application.attach(Application.java:194)  at android.app.Instrumentation.newApplication(Instrumentation.java:992)  at android.app.Instrumentation.newApplication(Instrumentation.java:976)  at android.app.LoadedApk.makeApplication(LoadedApk.java:532)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)  at android.app.ActivityThread.access$1800(ActivityThread.java:139)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5314)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.NoClassDefFoundError: com/eallcn/rentagent/MyDebugEallApplication at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:251)  at java.lang.Class.forName(Class.java:216)  at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155)  at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)  at android.app.Application.attach(Application.java:194)  at android.app.Instrumentation.newApplication(Instrumentation.java:992)  at android.app.Instrumentation.newApplication(Instrumentation.java:976)  at android.app.LoadedApk.makeApplication(LoadedApk.java:532)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)  at android.app.ActivityThread.access$1800(ActivityThread.java:139)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5314)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.eallcn.rentagent.MyDebugEallApplication" on path: DexPathList[[zip file "/data/app/com.eallcn.rentagent.debug-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.eallcn.rentagent.debug-1, /vendor/lib, /system/lib, /data/datalib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:251)  at java.lang.Class.forName(Class.java:216)  at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155)  at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)  at android.app.Application.attach(Application.java:194)  at android.app.Instrumentation.newApplication(Instrumentation.java:992)  at android.app.Instrumentation.newApplication(Instrumentation.java:976)  at android.app.LoadedApk.makeApplication(LoadedApk.java:532)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)  at android.app.ActivityThread.access$1800(ActivityThread.java:139)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5314)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)  at dalvik.system.NativeStart.main(Native Method)

 

18 comments

@Siddhant Senapati 2016-08-22 16:48:55

This error will happen when you add a blank activity with .java file. So to solve this error 1st you have to Build the project again. Then run it. Solved Thank You.

@SE apologise to Monica Cellio 2016-09-27 21:13:30

black Activity?

@CodeToLife 2018-05-21 11:30:09

No need to disable "instant run".
1. go to project's root using File Explorer
2. Finish Android Studio(AS)
3. delete(relocate somewhere) ".gradle" 's folder content
(to clean some cashs and old artifacts)
4. in res folder clean off all inappropriate files
5. launch the AS again
6. in module's build.gradle set "buildTypes { debug {minifyEnabled true" to false
(that looks like an error was in my proguard file, kek)

Sync, compile and run the app again :/

@Mohammad Tauqir 2017-08-04 07:23:21

If you are sharing your app then another solution is

go to Android Studio --> Build --> Build APK

A pop up will come with APK generated successfully. Show in Explorer will get you to the generated apk folder.

@Anthony 2017-01-26 10:03:23

I just needed to reboot my device. Tried everything else first unfortunately so wasted hours.

@Jorgesys 2016-12-01 17:16:35

In some Android devices with versions before OS 5.0 we get the error message:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication

We must disable "Instant Run".

Go to File > Settings > Built, Execution, Deployment > Instant Run

Then disable the option Enable Instant Run to hot swap code.

enter image description here

@IgorGanapolsky 2015-12-21 00:19:51

I was able to get rid of this error by updating gradle-wrapper.properties to gradle-2.14.1-all, and cleaning/rebuilding the project. Then it ran fine. No other changes were needed (as those suggested in the above answer)...

@Liuting 2016-01-18 12:27:30

Are you using com.android.tools.build:gradle:2.0.0-alpha1? The error still exists for me after I upgrade it to com.android.tools.build:gradle:2.0.0-alpha6 + https\://services.gradle.org/distributions/gradle-2.10-all.z‌​ip

@Liuting 2016-01-18 14:34:06

Yeah I upgraded to Android Studio Preview 5, it says I have to upgrade the gradle version for instant run. It seems they are making quite frequent alpha releases for bug fixes..

@Bhuro 2016-08-29 14:02:22

If you are working on Client's project / your own product, the 'alpha' or 'beta' builds are not suggestible to use; instead try to use one or 2 down versions ... Cause they are not stable one. And if you are testing the unstable build for bug fixing and improvements, even the android studio from cannery channel can help more in the process ...

@kumar kundan 2016-09-06 06:03:45

I also faced the same problem and i solved it. In my case it was due to a mistake in global class ( Throughout Application context class ) , my mistake was in AndroidManifest.xml i have declared the Application class VolleyHelper as :-

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true" android:name=".VolleyHelper"
        android:theme="@style/AppTheme"> 

but in VolleyHelper.java i don't have a Default constructor . So i added default constructor in VolleyHelper.java ( Application Class ) .

@Narendra Singh 2016-06-14 09:22:14

Just go to Android Studio menu - Build --> Rebuild Project.

@ahmed ghanayem 2016-06-14 09:06:49

Change classpath 'com.android.tools.build:gradle:2.1.2' to classpath 'com.android.tools.build:gradle:2.1.0' fixes my problem.

@user3682694 2016-06-09 16:59:04

you can also add this into your gradle to prevent making dex on debug

debug {
    // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
    // to pre-dex each module and produce an APK that can be tested on
    // Android Lollipop without time consuming dex merging processes.
    minSdkVersion 21
}

@Calixto 2016-05-31 18:46:31

I had the same error.

I solved it by cleaning the project ( Build > Clean Project )

@Anup 2016-10-07 07:35:57

underrated answer!

@Shawn 2017-01-18 22:29:30

This appears to be the correct answer for me. I was getting the issue without using Android studio so I just ran a gradle clean and gradle assembleDebug which does the same thing.

@peeyush pathak 2016-01-14 08:32:13

Disable the Instant Run option in Android Studio. Instructions are in the Android Studio Instant Run documentation.

Instant Run tries to do hot swapping of your code; this causes the application class to be moved.

To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"

@Anthony 2016-01-14 12:13:12

This solve the issue to me. Thanks for that. It should be the good answer.

@Shirane85 2016-01-21 08:05:59

Yes, this is the solution. Instant run is not stable enough i guess.

@Jon 2016-02-26 21:27:17

This just happened to me on a Marshmallow device

@abat 2016-03-01 22:04:36

Worked for me! Thanks!

@Anup Dasari 2016-04-18 06:02:22

@GeekHades This is the best answer.

@nAkhmedov 2016-04-20 13:10:46

The same issue on Samsung Galaxy S3

@Zubair Ahmed 2016-05-09 12:41:55

Excellent Great answer (Y)

@Tino 2016-05-15 12:27:40

Thank you! This was exactly what I need!

@Parth Anjaria 2016-05-23 07:46:20

It worked for me. but why is it that the instant run creates this issue? @peeyushpathak

@peeyush pathak 2016-05-23 09:04:46

First time it packs up the class in one dex file and second time it packs up in other dex file. So on 2nd time the interpretor searches for that particular class int first dex file but it is not present there.

@natario 2016-05-25 12:32:16

Am I the only one who thinks that disable this major feature of your IDE is NOT a good solution? It’s like saying use Studio 1.4. Downvoted.

@LarsH 2016-07-08 19:54:52

@mvai: It's not an ideal solution, but it may be the best solution available. If the problem is caused by Instant Run, then knowing that and being able to disable it at times is extremely valuable. Downvoting this answer is like shooting the messenger who told you not to take the shortest route home because there was an ambush waiting for you..

@natario 2016-07-08 20:01:51

@LarsH then IMO the answer should clearly state that this is a temporary solution, that we are waiting for a fix, possibly linking to a bug report, explaining what you’ll miss if you disable instant run, mentioning there might be better solutions/workarounds.

@LarsH 2016-07-08 20:13:30

@mvai: OK, those things could arguably be done to improve the answer (though 4 of the 5 seem obvious). But downvoting is not for "this answer could be even better" but is for "this answer is not useful". Whereas this answer is very useful. Feel free to add the details that you think would improve the answer; either here or on your own answer.

@Fenil 2016-08-10 10:18:01

Instead of disabling instant run, better solution is to select Run option instead under Run Menu in Android Studio.

@natsumiyu 2016-08-24 09:00:46

I cannot see the File -> Settings I'm using Android Studio 2.1.2

@peeyush pathak 2016-08-24 09:01:37

which os are you using

@natsumiyu 2016-08-25 00:58:34

@peeyushpathak I'm using OS X El Capitan

@Swas_99 2016-09-08 08:09:33

I think "clean project" / "Re-build project" should be enough to fix the issue

@clu 2017-01-10 05:06:18

This is a sad answer, but because Instant Run is so broken it's the only correct solution.

@peeyush pathak 2017-01-11 04:57:27

@clu cannot do much about it. So just wait till it is stable and working fine.

@A. Petrov 2017-02-01 12:05:29

it could be a better if all of voters send a log to google, every time when this issue occurs...

@albert c braun 2017-03-30 22:59:05

Running Android Studio 2.3, Gradle 3.3, Android Plugin 2.3.0, this problem (and its solution in this answer) are still current. Thank you for this answer.

@albert c braun 2017-03-30 23:51:42

There seems to be an existing bug report for this: code.google.com/p/android/issues/detail?id=224993 but it does not have much support. You might want to vote for it.

@Yogesh Seralia 2017-04-05 09:57:23

Now, Uninstalling the app and disabling the instant run made, .so files linkable to to code.

@L.Grillo 2017-04-13 08:47:25

instant run is evil

@Fahid Nadeem 2017-10-16 13:48:29

WHY GOOGLE WHY??

@banguru 2016-04-10 13:52:16

I also got this error with Android 2.0 in stable channel.

What I did?
- I had an older version of the app already installed on the device (which was built using older version of the Studio) which I was trying to replace by running the newer app on device.
I just uninstalled the older version completely before running the new app and the trick worked.

@easycheese 2016-04-09 17:13:19

If you don't want to disable Instant Run, just do a project clean and rerun.

@Mahendra Chhimwal 2016-02-10 12:02:14

Just for those who want to update classPath with latest gradle plugin version, Where to find latest plugin version?

Check in http://tools.android.com/tech-docs/new-build-system and update your classPath. Latest one at current is

 classpath 'com.android.tools.build:gradle:2.0.0'.

Always try to build with latest plugin version.

@Mr.Moustard 2016-02-18 09:58:43

I just update Android Studio to the last version (2.0 Beta 5). It changes itself to classpath 'com.android.tools.build:gradle:2.0.0-beta5' and works like a charm.

@ar-g 2016-01-19 14:55:24

Changing to

classpath 'com.android.tools.build:gradle:2.0.0-alpha6'

fixed issue

@emmgfx 2015-11-28 17:32:34

I had the same error after trying to use the 2.0.

I solved it by reverting some gradle changes:

1/3:

Changing:

classpath 'com.android.tools.build:gradle:2.0.0-alpha1'

By:

classpath 'com.android.tools.build:gradle:1.2.3'

2/3:

Changing:

buildToolsVersion '23.0.2'

By:

buildToolsVersion "21.1.2"

3/3: (in <project folder>/.idea/gradle.xml)

And:

<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.8" />

By:

<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" />

I don't know what line is exactly the origin of the error, but with this three changes it was solved.

Hope that it helps you :)

@GeekHades 2015-11-30 02:58:24

The third step: <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" /> where can I find , I want to change. I can find the code!

@emmgfx 2015-11-30 09:08:32

Hi, see the edited answer. (<project folder>/.idea/gradle.xml)

@Marc 2015-12-10 21:31:36

first 2 steps seemed to fix it for me.

@IgorGanapolsky 2015-12-21 00:16:32

What is option name="gradleHome"? Where is that located.

@Stoycho Andreev 2016-02-07 14:41:02

If you have in your application build gradle : aaptOptions.setProperty("cruncherEnabled", false), it is better to remove it. And one more thing DON'T use instant run until it is full stable, makes a lot of problmes

Related Questions

Sponsored Content

11 Answered Questions

[SOLVED] Proper use cases for Android UserManager.isUserAGoat()?

102 Answered Questions

[SOLVED] Close/hide android soft keyboard

1 Answered Questions

[SOLVED] When I run the program then I face runtime issue

  • 2019-02-02 19:23:17
  • ajinkya jadhav
  • 53 View
  • 2 Score
  • 1 Answer
  • Tags:   android

1 Answered Questions

[SOLVED] java.lang.NoClassDefFoundError: okhttp3.logging.HttpLoggingInterceptor$Logger

  • 2017-10-16 17:26:27
  • Ksenia
  • 772 View
  • 0 Score
  • 1 Answer
  • Tags:   android

1 Answered Questions

[SOLVED] Crash - Runtime exception (MultiDex.java:178)

2 Answered Questions

Android Studio Error..Works on some devices and not others

1 Answered Questions

Didn't find class on DexPathList

1 Answered Questions

1 Answered Questions

3 Answered Questions

[SOLVED] how to fill custom list in Fragment in android?

Sponsored Content