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"
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 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 ?
I am getting warnings in my Android app saying that my bytecode makes illegal references to java.awt and in some cases the runtime seems to replace invalid opcodes.
09-22 19:36:41.688: W/dalvikvm(831): VFY: unable to find class referenced in signature (Ljava/awt/Component;)
09-22 19:36:41.688: W/dalvikvm(831): VFY: unable to resolve virtual method 523: Ljava/awt/Component;.isLightweight ()Z
09-22 19:36:41.688: D/dalvikvm(831): VFY: replacing opcode 0x6e at 0x0000
Is there something I can do to tell the DX tool to clean out or replace these references earlier (like at compile time) so that the generated dex file no longer has those references?
You might try proguard. I don't know offhand if it can strip out unused methods inside a class, or if it only strips out entire classes. If it's the former, it will likely be able to get rid of the offending references. If it's the latter, probably not.
But in any case, these are just warnings, and are mostly harmless. The only "harm" is that it adds a bit of bloat to your dex file, which requires a bit of extra memory/disk space.
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.
I am trying to use the zip4j jar file in my android project to password protect the zip file in the application. Copied the jar in lib folder & added it to build path. The code compiles fine. But when I run the project it gives VerifyError.
NOTE: It works fine if I added the source code to the project instead of the jar.
E/dalvikvm(1502): Could not find class 'net.lingala.zip4j.core.ZipFile', referenced from method a.test.zip.ZipHelper.zipFilesWithStandardZipEncryption
W/dalvikvm(1502): VFY: unable to resolve new-instance 45 (Lnet/lingala/zip4j/core/ZipFile;) in La/test/zip/ZipHelper;
D/dalvikvm(1502): VFY: replacing opcode 0x22 at 0x002a
W/dalvikvm(1502): VFY: unable to resolve exception class 46 (Lnet/lingala/zip4j/exception/ZipException;)
W/dalvikvm(1502): VFY: unable to find exception handler at addr 0x78
W/dalvikvm(1502): VFY: rejected La/test/zip/ZipHelper;.zipFilesWithStandardZipEncryption (Landroid/content/Context;)V
W/dalvikvm(1502): VFY: rejecting opcode 0x0d at 0x0078
W/dalvikvm(1502): VFY: rejected La/test/zip/ZipHelper;.zipFilesWithStandardZipEncryption (Landroid/content/Context;)V
W/dalvikvm(1502): Verifier rejected class La/test/zip/ZipHelper;
D/AndroidRuntime(1502): Shutting down VM
W/dalvikvm(1502): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
where did you put your jar file?
not necessary, but in some cases it works as follows: you need to put your jar in assets folder. then you configure your Java builtpath. add the jar from assets folder, then (in eclipse, get to order and export tab and check the jar file) export the jar.
it automatically adds it into your applications lib folder. i don't know why but it didn't work the other way around (coppying the jar in lib and adding it to builtpath) in one of my applications.
you can also change your java compiler.