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
Happens for me only if instant run is enabled.
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.
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
you must add uses-library in your AndroidManifest.xml
Are you sure is this the first exception you are getting after running your application?
There may be some uncaught exceptions previously.
Related
Just started using lambdas in a new project and stuck with the issue when app crashes with the following stack trace:
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.test.-$Lambda$3>
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test, PID: 18852
java.lang.NoClassDefFoundError: com.test.-$Lambda$3
... method which calls lambda ...
The interesting thing is it works sometimes but I still can't figure out what makes it work and what breaks.
jackOptions and 1.8 compatibility are both enabled in build.gradle. compileSdkVersion is 25. Device is running Android 5.0. The resulting apk has this com.test.-$Lambda$3class defined.
Is there anything that should be done in addition to completely enable lambdas? How to debug this issue to find out the real root cause?
Update 1:
It sounds pretty strange but looks like compiler messes with lambda calls. Say the resulting APK has $Lambda$1:Runnable and $Lambda$2:Consumer defined and I see particular method calls $Lambda$1 while it has to be $Lambda$2.
Guys I am getting the below error in RunTime, what is the root cause of this error?
java.lang.VerifyError: appPackageName at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2698)
at android.app.ActivityThread.access$1900(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1413)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5457)
at java.lang.reflect.Method.invokeNative(Native Method)
You are probably using or accessing something which is simply supported in higher android SDK, as the error shows here java.lang.Class.newInstanceImpl(Native Method).
I happened to have the same kind of VerifyError while I was using String.isEmplty();. It seems you have same kind of problem as the message showing error in java.lang.Class
Thrown when the "verifier" detects that a class file, though well formed, contains some sort of internal inconsistency or security problem.
Here is official docs
Possible causes:
You might have imported something which is using different support v4/v7 library version.
You are targeting something from a higher SDK version. In that case, update your support repository and SDK build version.
Thanks everyone for your support and answers, may be your answers are right but in my case I used extra variables in one method while I was testing, so this exception appeared. Now I get rid of redundant things in my code and it start working. It may help others.
Can somebody please help me? I have a test SDL2 application which runs on my phone just fine. I took a copy of the sample app and began porting in code from my own application which builds and links just fine.
My application crashes on startup with the below error in the log (last line):
05-22 16:24:48.271 14834-14834/org.libsdl.app D/dalvikvm: Trying to load lib /data/app-lib/org.libsdl.app-13/libSDL2.so 0x42b0fb20
05-22 16:24:48.271 14834-14834/org.libsdl.app D/dalvikvm: Added shared lib /data/app-lib/org.libsdl.app-13/libSDL2.so 0x42b0fb20
05-22 16:24:48.271 14834-14834/org.libsdl.app D/dalvikvm: Trying to load lib /data/app-lib/org.libsdl.app-13/libmain.so 0x42b0fb20
05-22 16:24:48.281 14834-14834/org.libsdl.app A/libc: Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 14834 (org.libsdl.app)
I have commented out my main() code and replaced this content with the main() from the sample app and it still crashes.
I'm faced with the long-winded task of incrementally including source files and components until I can identify the cause.
Does anybody know of a common cause for this please?
I am doing a clean build and run each time.
It looks like you have logcat's output filtering on. There should be a stack trace in the output after the 'fatal signal' line, which is visible if you select 'No filters' in logcat. Decoding that stack trace will hopefully make your search a bit narrower.
all I am doing:
Eclipse --> new Project --> Android Application --> Activity type: blank
no changes in the code, just the simple Hello world.
It does start, I see the Hello World on the virtual device, but then immediately shuts down.
The logcat is as follows:
08-31 06:01:14.976: W/dalvikvm(1114): threadid=1: thread exiting with uncaught exception(group=0xb2aeeba8)
08-31 06:01:14.996: E/AndroidRuntime(1114): FATAL EXCEPTION: main
08-31 06:01:14.996: E/AndroidRuntime(1114): Process: com.example.tester, PID: 1114
08-31 06:01:14.996: E/AndroidRuntime(1114): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
08-31 06:01:14.996: E/AndroidRuntime(1114): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
Any Ideas?
Edit:
Ok, apparently I for some reason have a dependency mixup:
Found 2 versions of android-support-v4.jar in the dependency list,
[2014-08-31 12:22:46 - tester] but not all the versions are identical (check is based on SHA-1 only at this
Can I simply delete one of them?
The error is essentially telling you that it can't find the Android Support Library, which it is using as a dependency.
Without knowing what build process you're using (e.g gradle) it's difficult to tell you how to fix it, but basically you'll need to either add it as a dependency, or remove the code that requires it.
For more information on the Android Support Library, try this:
https://developer.android.com/tools/support-library/index.html
If do not work the try this :
Step #1: Undo all that. If you are messing with the build path, on R16 or higher version of the ADT plugin for Eclipse, you're doing it wrong.
Step #2: Pick one of those two versions of the JAR, or pick the one from the "extras" area of your SDK installation.
Step #3: Put the right JAR in App Library.
Step #4: Delete the one from App Free, since it will pick up that JAR from App Library.
I'm developing for 2.2 (minSdkVersion=8) and suddenly I'm getting this error:
arbitrarily rejecting large method (regs=75 count=28584)
rejected Lcom/Demo/Loyalty/SelectType;.onClick (Landroid/view/View;)V
Verifier rejected class Lcom/Demo/Loyalty/SelectType;
Class init failed in newInstance call (Lcom/Demo/Loyalty/SelectType;)
java.lang.VerifyError: com.Demo.Loyalty.SelectType
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
It was working fine until now.
Note : SelectType class has around 16000 lines of code but that is not that large I guess.
I search a lot on net and from answers, I did following:
Clean the project
Reset the ADB
Restart emulator/device/eclipse
Checked that third party library field is checked in build path
But I'm still getting that error.
Any help appreciated.
The steps you've described probably won't help.
The thing is, it's not a Dalvik issue. Similar verifier is employed in the Oracle Java VM for example. Simple answer: your method is too complex. The error you see is mainly caused by too many:
parameters
local variables
exception handlers
code instructions
More precisely, the issue has been described in this thread: https://groups.google.com/forum/?fromgroups=#!topic/android-developers/4qNoIdBHYFc
To quote:
The value of (number of registers * number of instruction words) is
larger than 2^21. (...)
it's intended to
prevent the verifier from bloating up an app's native heap.
You can also see similar report here: http://www.mentby.com/Group/android-developers/verifyerror-arbitrarily-rejecting-large-method.html with pointers on how to resolve the issue:
Yep, the Dalvik compiler attempts to assign a "register" to every
local variable in the method. It should be able to handle that many,
but apparently can't. By making them instance variables you remove
the compiler's need/desire to "manage" them (and also make the method
a fair amount smaller).
So to solve it, you should generally break the large method (probably onClick()?) into smaller pieces. Also, converting local variables to class fields seemed to help some people with the same issue.