Asked  7 Months ago    Answers:  5   Viewed   28 times

I just allowed my Mac to do an update on its Java installation and now some of my old jars (like javax.mail and apache.commons.httpclient) are throwing "class not found" exceptions at run time!

Meaning, they compile fine, but then crash at run time with exceptions that look like this:

E/dalvikvm(2414): Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.my.project.Main.isValidEmailAddress

Do I need to get more recent versions of the jars that have those classes? Or do I need to revert to my previous version of Java?

Or is this some totally unrelated problem that I'm just assuming has to do with the Java update (would be quite a coincidence, all of this worked perfectly prior to the update)?

 Answers

59

crash at run time with exceptions that look like this: Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.my.project.Main.isValidEmailAddress

If you have problems with external jars, then:

  1. create a folder named libs.
  2. Copy and paste all needed external jar files into that folder.

It will automatically be included, as explained on this page: Dealing with dependencies in Android projects

Tuesday, June 1, 2021
 
Deyson
answered 7 Months ago
24

Your app level gradle dependencies should include (as per butterknife website instructions):

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

You can remove the line :

apply plugin: 'com.neenbedankt.android-apt'

Annotation Processing became available in Android Gradle plugin (2.2 and later) so there is now no need to use the above plugin anymore if using this version of gradle or greater.

If you'd like to know how to turn annotation processing off and on and AS the setting is in :

Settings > Build, Execution, Deployment > Compiler > Annotation Processors

Wednesday, June 30, 2021
 
BartmanEH
answered 6 Months ago
70

Setting the directory to: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home in JDK settings solved my issue. I had the same problem getting started up. Hope this helps!

Thursday, July 8, 2021
 
Uours
answered 5 Months ago
45

Make sure your JDK Version through Project Structure

enter image description here

You can add this in your gradle section

    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
Wednesday, August 4, 2021
 
Webroots
answered 4 Months ago
25

Older versions of Realm use android-apt. You should upgrade your realm-android plugin version.

Thursday, November 4, 2021
 
Seibar
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :  
Share