An error occurred after update the Android SDK Too

2019-04-19 03:55发布

问题:

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:

  1. Copy external jars to my project's "libs" folder. (I have already do this before)
  2. Properties->Java Build Path->Projects and add the library project there.
  3. clean and rebuild
  4. reset the computer or IDE
  5. Try other project which also contains project lib
  6. 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

回答1:

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



回答2:

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



回答3:

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.



回答4:

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.