Getting a java.lang.NoClassDefFoundError for every jar file - java

I have recently reinstalled my computer, installed latest version of Android SDK and Eclipse.
And now every project that I have, I'm getting a "java.lang.NoClassDefFoundError" for every jar file included in every project.
I am a Java beginner, I have spend the last week on forums, but cannot get to fix it.
Could someone please help me ?
Thank you

You were probably using an out-of-date version of ADT prior to reformatting. Post ADT 17, libraries either need to be copied to the libs folder of your project, or they need to be marked as exported on the build path. Otherwise, the libraries will not be packaged with the APK binary, thus you will get NoClassDefFoundError when using those libraries.

Related

Eclipse 2020-06 - Error The project was not built since its build path is incomplete

I have already read a lot about this error but I can't fix it on my eclipse 2020-06
I installed ide for web and javascript developers and jdk 11.
I did some changes to my projects in order to migrate them from java 1.8 to java 11.
I have only some errors to fix.
The first is:
The project was not built since its build path is incomplete. Cannot find the class file for javax.xml.rpc.Stub. Fix the build path then try building this project.
The second is:
The type javax.xml.rpc.Stub cannot be resolved. It is indirectly referenced from required .class files...
They are related, so I think the problem is the same.
I read that lib has been removed in java 11.
I tried all solutions online but I can't fix it.
Can anyone help me please?
Thanks
EDIT: I added lib tab as required:

Does Android API 18 supports jdk1.7.0_80?

I use jdk1.7.0_80 for my project but there is a .jar file which apparently compiled with jdk1.6. I'm getting some exception related to that library and tells some files are not defined but I didn't modify anything related to that since six months ago. I want to know the conflict between used JDKs break something?
if you open old projects usually version conflicts will happen. gradle, android tools even android studio had an issue after upgrade. but in your case you say jar file compiled with 1.6 and java 7 had a problem. with java 8, my old jar file didnt created a problem in my project so you might want to delete jdk 7 and install jdk8update74, which is the latest version.

`AndEngine` Samples are not running on Eclipse by updating to Latest anddorid SDK and ADT

It was working fine but when i updated my eclipse to latest ADT and SDK it gave me this error.
12-15 14:58:07.501: E/AndroidRuntime(639): java.lang.NoClassDefFoundError: org.andengine.AndEngine
If any one faced this before then please help me, because of this my AndEngine projects are also giving me the same error.
Thanks.
I have solved this issue by following these steps.
First I created new Library called AndEngineLibs and add all AndEngine supporting libraries to it.
Then in the project properties->java build path->Order and Export is checked the AndEngineLibs
like shown. I don't know it is related or not but it worked for me :)
There are only three reasons you will ever get this error:
The class genuinely doesn't exist. If you are using code from an official example and getting this, make sure you have the latest build of the library
You have not added the jar to your build path. To fix this, right click on the jar in Eclipse, and do Build Path ► Add to Build Path.
Your jar is not in the /libs folder. This happens when you have added the jar to the build path, but newer versions of ADT need it to be in /libs. Put it there and re-add it to the build path.
Mostly, such errors occur because newer versions of the ADT require all external jars to be in the libs folder.

Android Project with ActionBarSherlock doesn't get built

I implemented the current version of ActionBarSherlock to my Android Project.
Everything works fine and I don't get any errors.
But when I try to debug or export my project I don't get an .apk-file out of my project. Just a .jar-file with the name of my project.
I've read about some problems the SDK had with building projects that contain external libraries but this was at SDK version 14 and so I hope, this bug is fixed...
So there might be another cause for this problem.
Does anybody know a possible solution?
You cannot get *.jar file as the result of building Android project. This seems very strange to me. There must be something wrong with your project settings (if you changed them), or the project you build is of the wrong type (i.e. it is Java Application instead of Android Application).
You didn't mention which IDE do you use, but I assume you use Eclipse.
Make sure you have installed Android SDK and Eclipse ADT correctly (just in case).
Next thing to try is to create a new Android Application project from existing sources (there should be such option during the process of creation).

Error when building apk - "Multiple dex files define Lcom/google/ads/Ad"

I've been tearing my hair out over this one, for the past 3 hours I've been trying to fix it but have been unable to. I've created an android app and I'm ready to put it on the android market but I get this error when trying to export to an apk.
Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad;
I've read a bunch on the problem and tried quite a few solutions but nothing has seemed to help. I've cleaned and rebuilt, I've delete the bin folder, I've made sure that the bin folder is excluded build path. Nothing's worked. If anyone could help me I would really appreciate it.
Untick the admob jar file in the "order and export" part of the "configure build path".
On another post with a problem similar to yours the only thing mentioned that you have not already considered was updating Eclipse. I don't know how or what order that you have done these "fixes" but another poster mentioned that all at once he deleted the bin directory for his project, cleaned and rebuilt the project and restarted Eclipse. After that the error disappeared.
Good Luck- Lijap
For me the error was due to 2 different versions of AdMob SDK being included accidentally.
Removing one of them fixed it.
As other have noted, this problem should be due to multiple versions of Goodle's ad SDK classes being included in the app build. What I haven't seen yet is a note that the most recent Google Play Service lib includes classes that (at least) share the same names as some in the admob sdk-- for example, I came upon this error because I was trying to build with both admob sdk v.4.0.4 and the google-play-services_lib project as a referenced project; the latter contains google-play-services.jar which contains the package com.google.ads and many of the same classes as the admob sdk. Thus it appears that the google play services lib and the admob sdk cannot both be used in a given app. My solution was to remove the admob sdk entirely from the build.
I had the same or a similar problem. My problem was that my application imported a library which used a different version of AdMob SDK.
Details of my problem:
Library used AdMob SDK 6.3.0
Application used AdMob SDK 6.1.0
Fixed it by including the same version.
For me, I just have to take out the libs folder which contains android-support-v4.jar from build path and it worked.

Categories

Resources