Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error "java.lang.NoClassDefFoundError: com.android.tools.fd.runtime.AppInfo"

When i launch app it getting me this error

FATAL EXCEPTION: main
                                                     java.lang.NoClassDefFoundError: com.android.tools.fd.runtime.AppInfo
                                                         at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:229)
                                                         at android.app.Application.attach(Application.java:181)
                                                         at android.app.Instrumentation.newApplication(Instrumentation.java:991)
                                                         at android.app.Instrumentation.newApplication(Instrumentation.java:975)
                                                         at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
                                                         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
                                                         at android.app.ActivityThread.access$1300(ActivityThread.java:141)
                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
                                                         at android.os.Handler.dispatchMessage(Handler.java:99)
                                                         at android.os.Looper.loop(Looper.java:137)
                                                         at android.app.ActivityThread.main(ActivityThread.java:5103)
                                                         at java.lang.reflect.Method.invokeNative(Native Method)
                                                         at java.lang.reflect.Method.invoke(Method.java:525)
                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                         at dalvik.system.NativeStart.main(Native Method)
like image 497
Dedaniya HirenKumar Avatar asked Jan 06 '23 03:01

Dedaniya HirenKumar


2 Answers

Disable Instant Run, delete the build folders and then rebuild project. See if it works

like image 157
Mark Shen Avatar answered Jan 08 '23 18:01

Mark Shen


In fact

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

https://developer.android.com/studio/run/index.html

Instant Run pushes updated code and resources to your connected device or emulator by performing a hot swap, warm swap, or cold swap.

So you'll get NoClassDefFoundError. To solve the problem you can either do one of these:

1- Disable Instant Run by going to: File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run" enter image description here Or

2- Perform Clean and Rebuild the app.

like image 29
Milad Faridnia Avatar answered Jan 08 '23 18:01

Milad Faridnia