0

Using Android Studio, I recently created a library from a project I am working on. Since including it on the new project, every single time I reference the library's methods it throws a java.lang.NoClassDefFoundError.

I CAN ctrl + B and visibly see my own source code so I know it is there and visible and not obfuscated.

Whenever I re-run the app, I see this in the logcat - "Rejecting re-init on previously-failed class java.lang.Class".

I have spent the better part of 2 days trying to research and get this to work with no avail. Does anyone know why I would be receiving this error if it is my own library I have included?

I have already read through the following Stack Overflow links (without success) so please do not include these as an answer / solution:

  1. How do I resolve this Java Class not found exception?
  2. Unity Android with AppCompat Rejecting re-init on previously-failed class java.lang.Class
  3. NoClassDefFoundError - Rejecting re-init on previously-failed class
  4. NoClassDefFoundError on external library project for Android
  5. Android library project "java.lang.NoClassDefFoundError"
  6. Android Activity ClassNotFoundException - tried everything
  7. java.lang.NoClassDefFoundError when use my own library

Thank you for your time.

Community
  • 1
  • 1
PGMacDesign
  • 6,092
  • 8
  • 41
  • 78
  • Have you tried adding it as a library using option in "Add as Library" in Android Studio? – sumandas Nov 15 '16 at 18:44
  • I have indeed Sumandas. I have also published it via an online repo with Jitpack only to have the same issue. – PGMacDesign Nov 15 '16 at 18:46
  • Is it a jar? If yes, try adding the jar and then use the jar as library to be included in the gradle files. – sumandas Nov 15 '16 at 18:50
  • I first tried it as a jar file, compiled, but same issue. Then tried it as an aar file. Compiled, but same issue. It seems like the issue is my library's code itself is invoking the exception, I just have no clue how that would happen. – PGMacDesign Nov 15 '16 at 19:16
  • Hello @Silmarilos, did you manage to find a solution for this ?I am also stuck in the same problem. – Siddharth-Verma Jun 28 '17 at 05:30
  • I never found a definitive solution. I did fix it, but I cannot pinpoint what the solution was. What I do remember is that I ended up having to include many of the libraries I was using as Jar files and compile the library with @aac at the end to include said jar files. Hopefully that puts you in the right direction. – PGMacDesign Jun 28 '17 at 14:58

0 Answers0