I try to implement a Backup Agent in my Android app, and I've got a weird issue every times it restore (at first launch) :
Unable to resolve superclass of Lcom/actionbarsherlock/app/SherlockMapActivity; (916)
Link of class 'Lcom/actionbarsherlock/app/SherlockMapActivity;' failed
Unable to resolve superclass of Lnet/myapp/activity/impl/MapActivity; (674)
Link of class 'Lnet/myapp/activity/impl/MapActivity;' failed
Could not find class 'net.myapp.activity.impl.MapActivity', referenced from method net.myapp.helper.SlidingMenuHelper.<clinit>
VFY: unable to resolve const-class 1520 (Lnet/myapp/activity/impl/MapActivity;) in Lnet/myapp/helper/SlidingMenuHelper;
VFY: replacing opcode 0x1c at 0x0081
Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lnet/myapp/helper/SlidingMenuHelper;
Complete log here : https://gist.github.com/romainguefveneu/1acc78cabbed65fba4b7
The restore process works just fine, when I open a second time the app, my data are correctly restored.
It seems to be an issue with the loading of SherlockMapActivity, I use all those libs in my project :
actionbarsherlock-plugin-maps-4.2.0.jar
bugsense-3.0.1.jar
commons-io-2.0.1.jar
gson-2.2.2.jar
joda-time-2.1.jar
ocpsoft-pretty-time-1.0.7.jar
Does someone has an idea ?
Related
I'm not sure where this error is generating from. My application works fine and I've not come across any crashing; however I receive the below in my LogCat.
My application uses an ActionBar and ListView. Anyone come across this before?
EDIT: Seems to be only happening when running on Android 2.x
Could not find method android.widget.LinearLayout$LayoutParams., referenced from method android.support.v7.internal.view.menu.ActionMenuView$LayoutParams.
VFY: unable to resolve direct method 8309: Landroid/widget/LinearLayout$LayoutParams;. (Landroid/widget/LinearLayout$LayoutParams;)V
VFY: replacing opcode 0x70 at 0x0000
VFY: dead code 0x0003-0007 in Landroid/support/v7/internal/view/menu/ActionMenuView$LayoutParams;. (Landroid/support/v7/internal/view/menu/ActionMenuView$LayoutParams;)V
This sounds like those classes are missing from your apk. Make sure to include the necessary Jars into your Apk (sounds like the support library).
Also in relation to this error, this is due to the Class Loader trying to resolve the reference in your code to actual operation codes (opcode) that the OS can recognize.
I had somewhat a similar issue. But later I found that I was trying to call a menu which does not exist.
I came back to work today and I started debugging my app using the emulator (KitKat), and my app runs ok. I had made some changes since last Friday, but not much.
Then I moved to the device (Gingerbread) and notices the app, that was working last week, had started to crash right on main activity's setContentView(). Here are the warning/error messages:
W/ActivityThread﹕ Application com.example.myapp is waiting for the debugger on port 8100...
W/dalvikvm﹕ VFY: unable to resolve static method 790: Landroid/net/TrafficStats;.setThreadStatsTag (I)V
W/dalvikvm﹕ VFY: unable to resolve instance field 50
W/dalvikvm﹕ VFY: unable to resolve virtual method 95: Landroid/app/Activity;.getFragmentManager ()Landroid/app/FragmentManager;
W/dalvikvm﹕ Unable to resolve superclass of Lmaps/aj/r; (671)
W/dalvikvm﹕ Link of class 'Lmaps/aj/r;' failed
W/dalvikvm﹕ Unable to resolve superclass of Lmaps/ay/an; (6382)
W/dalvikvm﹕ Link of class 'Lmaps/ay/an;' failed
W/dalvikvm﹕ Unable to resolve superclass of Lmaps/c/i; (6613)
W/dalvikvm﹕ Link of class 'Lmaps/c/i;' failed
E/dalvikvm﹕ Could not find class 'maps.c.i', referenced from method maps.e.al.a
W/dalvikvm﹕ VFY: unable to resolve new-instance 6818 (Lmaps/c/i;) in Lmaps/e/al;
All these messages appear after the setContentView method.
I noticed that it mentions getFragmentManager, however that's not part of my app. Since it has API 9 compatibility, I'm using the AppCompat v7, getSupportFragmentManager and including the Supporteverywhere it is needed.
I've undone the changes I did earlier today, but it still doesn't work.
Is it possible that the appcompat lib was updated recently? I'm using Gradle to get most of them:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:+#aar'
compile 'com.google.code.gson:gson:+#jar'
compile 'com.google.zxing:android-integration:+#jar'
compile 'com.googlecode.libphonenumber:libphonenumber:+#jar'
compile 'com.intellij:annotations:12.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Facebook')
}
I don't know how to debug these VFY errors. What can I do to try to solve them?
I don't know how to debug these VFY errors
They are not errors. They are warnings. The "W" in the beginning of each line is short for "warning".
Those warnings are merely noting classes, methods, and other symbols that Dalvik saw when loading classes from your APK that it could not resolve. So long as you do not actually execute any code that contains any of that missing stuff, everything will be fine. Moreover, they are largely unavoidable, as they are a natural side-effect of application and library code using newer capabilities on newer devices where those capabilities are supported.
When I play with Getting Started exercise "Using Worklight API in native Android applications", I get failed to connect to worklight server from native Android page, and error messages below:
Unable to resolve superclass of Lcom/worklight/androidgap/WLDroidGap; (435)
Link of class 'Lcom/worklight/androidgap/WLDroidGap;' failed
Could not find method com.worklight.androidgap.WLDroidGap.getWLConfig,
referenced from method com.worklight.common.WLUtils.checkIfMediaFile
VFY: unable to resolve static method 253: Lcom/worklight/androidgap/WLDroidGap;
.getWLConfig ()Lcom/worklight/common/WLConfig;
VFY: replacing opcode 0x71 at 0x0001
Unable to resolve superclass of Lcom/worklight/androidgap/WLDroidGap; (435)
Link of class 'Lcom/worklight/androidgap/WLDroidGap;' failed
Could not find method com.worklight.androidgap.WLDroidGap.getWLConfig,
referenced from method com.worklight.common.WLUtils.computeChecksumOnResources
VFY: unable to resolve static method 253: Lcom/worklight/androidgap/WLDroidGap;
.getWLConfig ()Lcom/worklight/common/WLConfig;
VFY: replacing opcode 0x71 at 0x0021
Unable to resolve superclass of Lcom/worklight/androidgap/WLDroidGap; (435)
Link of class 'Lcom/worklight/androidgap/WLDroidGap;' failed
VFY: unable to find class referenced in signature (Lcom/worklight/androidgap/WLDroidGap;)
Unable to resolve superclass of Lcom/worklight/androidgap/WLDroidGap; (435)
Link of class 'Lcom/worklight/androidgap/WLDroidGap;' failed
Could not find method com.worklight.androidgap.WLDroidGap.getLocalStorageWebRoot,
referenced from method com.worklight.common.WLUtils.findDrawableAsset
unable to resolve virtual method 248: Lcom/worklight/androidgap/WLDroidGap;
.getLocalStorageWebRoot ()Ljava/lang/String;
VFY: replacing opcode 0x6e at 0x0007
Skipped 31 frames! The application may be doing too much work on its main thread.
Environment information:
Operation System: Windows 7, 64 bit
Java: Oracle, 1.6.0_45, 64 bit
Installation type: Developer Edition
Eclipse: Java EE, Juno SR2
Worklight plug-in : 5.0.6.20130311
Environment details: Android, 4.2.2, API level 17, emulator
right-clicking on the Android project, choosing properties, Java Build Path, and Checking the Android Private Libraries under Order and Export
This problem can also be due two version of android-support-v4.jar in the dependency list,
delete android-support-v4.jar from your project libs folder. now clean and build your project and run.
Eclipse is seemingly having intense difficulties adding** 8 libraries to my project. Is there an unspoken maximum of 7 libraries per project that I haven't heard of?
I am getting issues saying that the compiler "Could not find class *"
An example is this:
favorite
I have a project that runs perfectly fine on newer devices and API levels, however, I'm getting some issues on emulators. When I load up the application on an emulator, I get this issue:
02-22 18:36:11.584: W/dalvikvm(652): VFY: unable to resolve exception class 872 (Lcom/google/zxing/WriterException;)
02-22 18:36:11.584: W/dalvikvm(652): VFY: unable to find exception handler at addr 0x7da
02-22 18:36:11.584: W/dalvikvm(652): VFY: rejected Lcom/example/myapp/Card;.getFrontView (Landroid/content/Context;)Landroid/widget/LinearLayout;
02-22 18:36:11.584: W/dalvikvm(652): VFY: rejecting opcode 0x0d at 0x07da
02-22 18:36:11.584: W/dalvikvm(652): VFY: rejected Lcom/example/myapp/Card;.getFrontView (Landroid/content/Context;)Landroid/widget/LinearLayout;
02-22 18:36:11.584: W/dalvikvm(652): Verifier rejected class Lcom/example/myapp/Card;
At first I thought it may have been either my library or how I was adding** it, but I've recently cleared*** all of my libraries and readded them and I'm getting the same issues on a different library.
02-25 21:03:45.379: E/dalvikvm(12018): Could not find class 'org.apache.commons.validator.routines.UrlValidator', referenced from method com.example.myapp.Card
02-25 21:03:45.379: W/dalvikvm(12018): VFY: unable to resolve new-instance 1054 (Lorg/apache/commons/validator/routines/UrlValidator;) in Lcom/example/myapp/Card;
These errors mean that the project doesn't have proper access to my library's classes, right? But why is the error inconsistent for which library it is? I've tried removing*** and readding the libraries the exact same way that the other libraries were added, but there's no luck on library #8.
What do I do?
** Adding: I've tried adding the libraries to a User Library (includes all of the existing documents that I have) and just simply copying the .jar to the libs folder.
* Removing: To get rid of the library, if it is inside a User Library, I will edit my User Library containing the .jar I'm looking to remove and use the "remove" option. Otherwise, I will simply right click and "delete" the library from the libs directory.
As for a "User Library"
I've written + imported my own library that includes an OAuth login feature. It needs to call "setContentView(R.layout.authorize)" on its own layout resource, authorize.xml which is defined in the library's res/layout folder. If I run the library as a regular project (using a test Activity), everything works fine. However, if I use the library in another project, I get the following error, indicating my authorize.xml layout cannot be found.
05-17 16:56:10.436: W/dalvikvm(212): VFY: unable to resolve static field 29 (twitter_authorize_webview) in Lcom/skworks/twitter/R$layout;
05-17 16:56:10.436: W/dalvikvm(212): VFY: rejecting opcode 0x60 at 0x0003
05-17 16:56:10.436: W/dalvikvm(212): VFY: rejected Lcom/skworks/twitter/AuthorizeActivity;.onCreate (Landroid/os/Bundle;)V
05-17 16:56:10.436: W/dalvikvm(212): Verifier rejected class Lcom/skworks/twitter/AuthorizeActivity;
05-17 16:56:10.436: W/dalvikvm(212): Class init failed in newInstance call (Lcom/skworks/twitter/AuthorizeActivity;)
Here is the code in my main activity
Intent i = new Intent(this, AuthorizeActivity.class);
i.putExtra("URL", mRequestToken.getAuthenticationURL());
this.startActivityForResult(i, TWITTER_AUTH);
And obviously this is in onCreate of my AuthorizeActivity class, found in the library.
setContentView(R.layout.authorize);
I'm sure something is not setup correctly to expose resources defined in my library. Any ideas?
You may need to check the build settings for your library. It could be that it is not packaging up the layout file into your jar/apk. It could also be that the project using the library is not bundling the files into the deliverable apk. That's where I would start looking.
Check imports, that you havnt imported the android.R.
Else as mtmurdock said, check that your project is being build, try clean it.
You might have an xml error.