NoClassDefFoundError - Eclipse and Android

后端 未结 27 995
夕颜
夕颜 2020-11-22 08:02

I\'m having a problem trying to run an Android app which, up until adding a second external library to its build path, was working fine. Since having added the scoreninja ja

相关标签:
27条回答
  • 2020-11-22 08:28

    John O'Connor is right with the issue. The problem stays with installing ADT 17 and above. Found this link for fixing the error:

    http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

    0 讨论(0)
  • 2020-11-22 08:28

    I tried everything from this post (and some other posts), and it didn't worked for me, this is by far the most terrible ADT upgrade I have experienced, and I will never upgrade without a working ADT backup.

    I managed to solve it by removing the project, and then adding it again using a source backup I had.

    0 讨论(0)
  • 2020-11-22 08:30

    please make sure your jar file is in the libs directory of your project in you are using newer ADT version with your eclipse.

    0 讨论(0)
  • 2020-11-22 08:30

    As i understood, your Project shows no errors, because you included the Jar. But the Jar won't be used, when your Project got "exported" to the device. Try this

    Project -> Properties

    Java Build Path / Order and Export

    [✔] Your Jar

    0 讨论(0)
  • 2020-11-22 08:31

    I have encountered the same issue. The reason was that the library that I was trying to use had been compiled with a standard JDK 7.

    I recompiled it with the -source 1.6 -target 1.6 options and it worked fine.

    0 讨论(0)
  • 2020-11-22 08:32

    If you prefer to know which files the workaround is related to here's what I found. Simple change the .classpath file to

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
        <classpathentry kind="output" path="bin/classes"/>
    </classpath>
    

    Replace the .classpath file in all library projects and in main android project. The .classpath file is in the root folder of the eclipse project. Of cause don't forget to add your own classpath entries, should you have any (so compare with your current version of .classpath).

    I believe this is the same result as going through the eclipse menus as componavt-user explained above (Eclipse / Configure Build Path / Order and Export).

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