Android + Zip4j-1.3.1 jar throws VerifyError - android

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.

Related

Android : Could not find method com.google.analytics.tracking.android.EasyTracker.getTracker

I have an app that makes use of the Google Analytics library. I recently moved the code into a new workspace and the app has stopped working. The code builds OK but when it runs it halts with the following error.
06-12 23:11:14.117: I/dalvikvm(31080): Could not find method com.google.analytics.tracking.android.EasyTracker.getTracker, referenced from method com.apps4care.v2conf.utils.analytics.raiseEvent
06-12 23:11:14.117: W/dalvikvm(31080): VFY: unable to resolve static method 7179: Lcom/google/analytics/tracking/android/EasyTracker;.getTracker ()Lcom/google/analytics/tracking/android/Tracker;
06-12 23:11:14.117: D/dalvikvm(31080): VFY: replacing opcode 0x71 at 0x0021
06-12 23:11:14.117: I/dalvikvm(31080): Could not find method com.google.analytics.tracking.android.EasyTracker.getInstance, referenced from method com.apps4care.v2conf.utils.analytics.start
06-12 23:11:14.117: W/dalvikvm(31080): VFY: unable to resolve static method 7178: Lcom/google/analytics/tracking/android/EasyTracker;.getInstance ()Lcom/google/analytics/tracking/android/EasyTracker;
06-12 23:11:14.117: D/dalvikvm(31080): VFY: replacing opcode 0x71 at 0x0000
06-12 23:11:14.117: I/dalvikvm(31080): Could not find method com.google.analytics.tracking.android.EasyTracker.getInstance, referenced from method com.apps4care.v2conf.utils.analytics.stop
06-12 23:11:14.117: W/dalvikvm(31080): VFY: unable to resolve static method 7178: Lcom/google/analytics/tracking/android/EasyTracker;.getInstance ()Lcom/google/analytics/tracking/android/EasyTracker;
The analytics JAR is in my "libs" folder and I can see it listed in the "Libraries" tab on the Java Build Path within Properties.
Any clues how I can fix this....
I'm assuming you're in Eclipse.
Right click on your project, select Properties.
Under Java Build Path, click on Order & Export tab.
Check Android Private Libraries and click OK.

Unable to resolve superclass of Lcom/worklight/androidgap/WLDroidGap

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.

An error occurred after update the Android SDK Tool REV 22 "Unable to resolve superclass of L"

The project is good yesterday, but when I update Sdk tools and ADT today(REV 22), the error occurred like "Unable to resolve superclass of L..." when I run the project.
My project uses ActionbarSherlock and SlidingMenu.
I have already tried:
Copy external jars to my project's "libs" folder. (I have already do this before)
Properties->Java Build Path->Projects and add the library project there.
clean and rebuild
reset the computer or IDE
Try other project which also contains project lib
Follow Class not found error after updating ADT and Android sdk tools to latest ver 22
But they are all failed.
The whole Logcat is below:
05-17 06:53:50.087: E/Trace(949): error opening trace file: No such file or directory (2)
05-17 06:53:50.188: W/dalvikvm(949): Unable to resolve superclass of Lcom/qdnews/utils/AsyncImageLoaderX$1; (50)
05-17 06:53:50.197: W/dalvikvm(949): Link of class 'Lcom/qdnews/utils/AsyncImageLoaderX$1;' failed
05-17 06:53:50.197: E/dalvikvm(949): Could not find class 'com.qdnews.utils.AsyncImageLoaderX$1', referenced from method com.qdnews.utils.AsyncImageLoaderX.<init>
05-17 06:53:50.207: W/dalvikvm(949): VFY: unable to resolve new-instance 177 (Lcom/qdnews/utils/AsyncImageLoaderX$1;) in Lcom/qdnews/utils/AsyncImageLoaderX;
05-17 06:53:50.207: D/dalvikvm(949): VFY: replacing opcode 0x22 at 0x001b
05-17 06:53:50.207: I/dalvikvm(949): Could not find method android.support.v4.util.LruCache.put, referenced from method com.qdnews.utils.AsyncImageLoaderX.addBitmapToCache
05-17 06:53:50.207: W/dalvikvm(949): VFY: unable to resolve virtual method 112: Landroid/support/v4/util/LruCache;.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
05-17 06:53:50.217: D/dalvikvm(949): VFY: replacing opcode 0x6e at 0x0007
05-17 06:53:50.237: I/dalvikvm(949): Could not find method android.support.v4.util.LruCache.get, referenced from method com.qdnews.utils.AsyncImageLoaderX.getBitmapFromCache
05-17 06:53:50.237: W/dalvikvm(949): VFY: unable to resolve virtual method 111: Landroid/support/v4/util/LruCache;.get (Ljava/lang/Object;)Ljava/lang/Object;
05-17 06:53:50.237: D/dalvikvm(949): VFY: replacing opcode 0x6e at 0x0005
05-17 06:53:50.257: W/dalvikvm(949): Unable to resolve superclass of Lcom/qdnews/utils/AsyncImageLoaderX$1; (50)
05-17 06:53:50.257: W/dalvikvm(949): Link of class 'Lcom/qdnews/utils/AsyncImageLoaderX$1;' failed
05-17 06:53:50.267: D/dalvikvm(949): DexOpt: unable to opt direct call 0x025a at 0x1d in Lcom/qdnews/utils/AsyncImageLoaderX;.<init>
05-17 06:53:50.277: D/AndroidRuntime(949): Shutting down VM
With rev 22, they added "Android Private Libraries".
For every related Project (including the actionbarsherlock project), right click it -> Properties -> Java Build Path -> Order and Export -> Check Android Private Libraries
Besides adding Android Private Libraries, that should be also related to the target SDK version.
Try set 'android:targetSdkVersion="17"' in the manifest XML, this solve my build problem recently after updating the SDK
After adding Android Private Libraries, I had the problem with
... Unable to execute dex: Multiple dex files define ...
... Conversion to Dalvik format failed: Unable to execute dex: Multiple dex ...
After deleting all libs except for "Android 4.2", "Android Dependencies" and "Android Private Libraries" the problem was solved and I could export my app.
I encounter the same problem when I update ADT and SDKTools for 22 ,and I trid all answer that I can find from internet,but it doesn't work ,at last ,try set 'android:targetSdkVerson="17"' in the project.properties,and clean it ,then problem solved.

Won't add 8th library

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"

Android library calls setContentView using its own resource, but fails with "unable to resolve static field"

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.

Categories

Resources