Unable to resolve superclass error when referencing .jar library

半城伤御伤魂 提交于 2019-11-27 18:31:43

Just started to get this issue after upgrading to ADT 17.

Discovered that external .jar files need to be in a 'libs' (with an s) folder otherwise their classes are not included in the .dex file that is created. Before the upgrade everything worked fine with my .jar files in a 'lib' folder (no s).

In my case I had to go to Properties->Java Build Path->Order and Export and check Android Private Libraries, then cleaned the project and worked fine.

Create lib folder, libs folder is for native libraries. I made it, add library to lib and to build path as internal library and it works!

Programmer Bruce

Are you using eclipse? If so, did you add the library to the build path as described in Adding a library/JAR to an Eclipse Android project?

I know that this a post on a really old thread, but after I read the answer by @rabidgremlin, I checked the folder structure, and found that it was already in "libs". However, on seeing the support.jar, I figured that using this was what was causing the issue.

I was extending "FragmentActivity" but it turns out, that was referencing the support.jar, which had issues in itself. Once I removed the extends clause, the app miraculously stopped crashing.

Just an FYI in case someone comes looking. Cheers!

I had the same problem, I tried to mark the Android Private Libraries under Order and Export and it didn't work for me. Then I noticed that my libs folder wasn't referenced under the Java Build Path. So I just added it to Libraries and it worked.

I had the same error message. Took me some time to figure out the problem: Android requires Java 1.6 to work. And the superclass of my Activity implemented an interface from a Java project that had Java 1.7 as compiler. That was enough for the dex builder not to be able to link the superclass and this resulted in the class not found exception.

I ran into a different cause for this error on Eclipse. I was experimenting with putting eclipse workspaces into google drive directories and discovered that certain superclasses can't be resolved from android activities.

Paused google drive and everything began working fine. In my case the superclass that wouldn't load was from a protocol buffers generated class. This class and all others I tested worked fine in non-android java programs, even while google drive was running.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!