9

Please somebody explain me what this error means and how to avoid it.

After a while my app Force Closes because of this error:

09-28 12:53:45.746 I/dalvikvm(29489): Rejecting re-init on previously-failed class Lcom/bartat/android/ui/task/AsyncTaskExt; v=0x0
09-28 12:53:45.748 D/AndroidRuntime(29489): Shutting down VM
09-28 12:53:45.755 I/am_crash( 1146): [29489,com.bartat.android.secret,572996,java.lang.NoClassDefFoundError,com.bartat.android.ui.task.AsyncTaskExt,CommandsActivity.java,726]
09-28 12:53:45.755 I/am_finish_activity( 1146): [1079225264,123,com.bartat.android.secret/.CommandsActivity,crashed]
09-28 12:53:45.750 W/dalvikvm(29489): threadid=1: thread exiting with uncaught exception (group=0x40015560)
09-28 12:53:45.752 E/AndroidRuntime(29489): FATAL EXCEPTION: main
09-28 12:53:45.752 E/AndroidRuntime(29489): java.lang.NoClassDefFoundError: com.bartat.android.ui.task.AsyncTaskExt

This problem couldn't be solved by reinstalling the app.

If I rename the AsyncTaskExt to AsyncTaskExt2 for example then it works again for long. But after a few weeks/months it started to get this error again.

What does it mean? Why it is thrown and how to avoid it without renaming the class?

Please help me, Tamás

Gray
  • 7,050
  • 2
  • 29
  • 52
bartat
  • 211
  • 1
  • 3
  • 7

5 Answers5

12

Happens for me only if instant run is enabled.

Tobias
  • 7,282
  • 6
  • 63
  • 85
11

This happens when a class couldn't be loaded for a variety of reasons. Unfortunately the new ART runtime doesn't log sufficient information as to the cause of this. If you can get hold of an older android device with Dalvik you'll see different logging, usually revealing the offence with more precision.

Last time I saw it live I had to deal with a JAR file that didn't actually include or list its dependencies, so adding the right dependent library to the gradle file solved it. The biggest issue is to figure which classes went missing - something dalvik logs/decompilation/documentation might be able to tell you.

There are many other reasons why classes can't be loaded in the entirety of the Java language so this specific cause might not apply universally.

Combuster
  • 583
  • 5
  • 19
3

I started having this problem after building another project with New Relic analytics enabled. Gradle daemon then cached the New Relic agent and it couldn't launch the other app.

What helped was

./gradlew --stop
Pavel Synek
  • 1,191
  • 8
  • 13
2

you must add uses-library in your AndroidManifest.xml

laowen
  • 45
  • 2
0

Are you sure is this the first exception you are getting after running your application? There may be some uncaught exceptions previously.

Durairaj Packirisamy
  • 4,635
  • 1
  • 21
  • 27
  • I don't know what cause this error, I mean are there any errors before it happens or not. But when this exception occurs there are no other errors in the log. I guess the system (vm?) stored somewhere that there was a problem with this class. But I haven't catched the first occurance yet. – bartat Oct 03 '12 at 06:01