Android Eclipse NoClassDefFoundError for external .jar files

前端 未结 7 1065
野趣味
野趣味 2020-11-27 06:46

I have come across a strange error. I have an Android project that uses external libraries, in particular:

  • android-support-v4.jar (for Fragment support in Andr
相关标签:
7条回答
  • 2020-11-27 07:08

    You need to read this - Dealing with dependencies in Android projects.

    This link is also useful - ClassDefNotFoundError with ADT 17

    Basically, create a folder called libs and place all of your jar files inside. The recent update will automatically take care of the rest for you. You don't need to edit your path anymore.

    0 讨论(0)
  • 2020-11-27 07:14

    If you see NoClassDefFoundError after upgrading to ADT 22, try this in Eclipse:

    • Go to Project PropertiesJava Build PathOrder and Export tab.
    • Check the Android Private Libraries option.

    Android Private Libraries option

    0 讨论(0)
  • 2020-11-27 07:15

    Android does not support Java1.7 up to now. Jars built with compliance level 1.7 cannot be used in Android Applications. Rebuild your Java project with compliance level 5.0 or 6.0 before exporting the jar file.

    I found this post via google and answers above didn't solve my problem. Hope what I say will be helpful to others.

    0 讨论(0)
  • 2020-11-27 07:17

    The way I solved it was by : Right clicking on the project and selecting build path. Select configure build path in the selections that appear. After that see if your libraries are there in the libraries folder and then select the order and export tab and over there select all your jar files. Then select ok and run your project.

    0 讨论(0)
  • 2020-11-27 07:19

    If you're using Eclipse with Maven IDE (m2e) go to "Java Build Path" then "Order and Export" and finally check the item "Maven Dependencies" and pull it down to the BOTTOM of the list. You should do the same with project references in the same workspace. Every time I setup the project in a new computer that happens.

    0 讨论(0)
  • 2020-11-27 07:21

    I ran into this error today too, because of updating to the Android SDK, r17. What the links that @aneal pointed out do not discuss is how to handle external runtime libraries (such as those imported under their own heading - not an imported user library).

    The easiest way to solve this problem is to change the build order in the build path. Simply right click on your project and select Properties. From here, select Java Build Path. At the top of the display, choose the tab order and export and move GoogleAdMobAdsSdk-4.3.1.jar above Android X (replacing x with the version you are using). Next, clean your project and run it. You should be good to go!

    0 讨论(0)
提交回复
热议问题