java.lang.NoClassDefFoundError on android - java

i am doing an application-email sending without user interaction. so that i got coding from the following link. here i got java.lang.NoClassDefFoundError: com.murali.email.GMailSender. i got this error at
GMailSender sender = new GMailSender("username#gmail.com", "password");
sender.sendMail("This is Subject",
"This is Body",
"user#gmail.com",
"user#yahoo.com");
in the MailSenderActivity Class. i added all external jars in referenced library and no error found at compile time. i spent more time to solve the issue but failed. i know it is possible of duplicate question but the other answers were not used for me. i guess me or eclipse miss some jar or class path for GMailSender class. please help me. i do not know how to solve it.

Make sure the jar sits in a folder named libs, not lib. Then perform "clean" and make sure the jar appears under Android dependencies.

If we get this error on android
java.lang.NoClassDefFoundError: javax.activation.DataHandler referenced from method javax.mail.internet.MimeMessage.updateHeaders
We need to add aditional.jar along with mail.jar and activation.jar. This solved my issue in android when accessing MimeMultipart.

Related

Resources not found after building a project in Netbeans 12

I have a java application that runs correctly when I execute it from Netbeans.
If I execute it as a .jar it does not work. I am getting the error "Caused by: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException"
The error is ocurring in this command:
Object object = parser.parse(new FileReader("src\\main\\resources\\companies.json"));
I think the problem is that I am not defining the resource paths properly. See screenshot
---------------UPDATE-------------------------
After spending many hours trying to solve this s*** problem, I still can not run the application from a jar. I also try to call the ressources like that:
InputStream inputStream = NewMain.class.getResourceAsStream("/com/companies.json");
but the same problem as before. When I start the applicaion from a batch file I get this message:
I am totally blocked. I would really apreciate if someone could help me
How are you generating the jar? This seems like the json class cannot be found at runtime and you need to add it to the classpath when building.
You can also check the responses at java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException with eclipse and spring.

Android ClassNotFoundException error at runtime

I am developing an app in Android Studio. The package name is com.mycompany.myapp . Then, I want to reuse some codes from another package : com.theta360.sample.v2 .
To do this, I added a package named "com.theta360.sample.v2" in Android studio. And then, I simply copied the src directory of com.theta360.sample.v2 to project/app/src/main/, which also includes mycompany/myapp .
In MainActivity.java. I need to use class LogView from theta360.sample.v2. So, added "import com.theta360.sample.v2.view.LogView".
Then, I successfully build the app.
However, when I launched the app on device, I received error with message:
..Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.LogView" on path: DexPathList...
My questions are:
(1) why at run-time, the system try to look for android.view.LogView; LogView is from com.theta360.sample.v2.view . How to fix it?
(2) What's the correct way to use another package with source. Can I simply copy the codes as I did above?
I have solved my own question. The error is caused by LogView used in the layout xml. It should be changed to a name with it's package prefix.

Android class not found NoClassDefFoundError

I need your help to resolve a class problem. When I run my virtual device, and when I click on button to call a method, that doesn't work.
I tryed with different libraries like itext and justformPDF (last one is java libraries).
I indicated it in build path but I have a mistake ... The class is not found :(
Thanks for your help :)
You can see the logcat here : www.aclebpokerclub.com/Application/LogCat.png

R cannot be resolved to a variable, usual fix doesn't seem to work

I am trying to compile my android app that I am crating by following the google tutorial at https://developer.android.com/training/index.html
I have run into a problem where I get the error "R cannot be resolved to a variable"
I followed the suggestions from the other threads such as cleaning/rebuiding, removing all import android.R, and reinstalling my Android SDK Build-tools for every version
Here is a copy of the tutorial project with the issue MyFirstApp.zip
I have taken the suggestions found in other threads, but their solutions have been unsuccessful.1 2 3 4 Please help!
Please let me know if there is any other information you need to fix this issue.
I have seen your code there is an error inside main_activity_actions.xml which is inside your menu folder
It does not find #string/action_search which must be present in strings.xml
So put <string name="action_search">Search here</string> inside your strings.xml
and clean and build the project.
I hope the error will be solved.
It usually append when you have an error with your XML file.
Maybe you try to use an XML variable who doesn't exist anymore. It will not give you any error on your XML.
Verify your XML variable on your file 'Value' and which you call from your Java file

net.java.util.tagValue : Not resolvable

In my program, I am trying to import below classes but there comes a compile time error for this. Am I missing any jar there ? If yes, then which jar I am missing. Please help me.
"import net.java.util.TagValue;"
I am writing this in eclipse
A simple search on the net shows that net.java.util.TagValue class belongs to fixparser library. Make sure that this library is in your classpath when working on your project.

Categories

Resources