0

I am facing Error:java.lang.NoClassDefFoundError when importing a jar and using its classes.

This problem might be thought of a duplicate to this question. But I have a different condition:

I have prepared a .jar file from Eclipse SDK for Android .so it has folder such as /res /assets etc.

I have goggled for solution tried some of the solutions:

  • Build path-> Configure BuildPath->Add External jar
  • Copy .jar to /libs directory.

None of them worked!!!

P.S. In a previous project i have already used SQLCipher.jar file by just by adding it to the build path and have faced no problems.Though It had some filename.dat (which i have to add into /assets folder) and i have no idea what so ever if that has any role in accessing methods in the class of the jar.

Community
  • 1
  • 1
Sidharth Dash
  • 333
  • 1
  • 4
  • 13

2 Answers2

1

I strongly recommend using Android Studio, the gradle build system is much easier than adding the libs manually. Just add compile 'net.sqlcipher:sqlcipher-gradle:3.0.1' to the build script, and the library will be downloaded and added with 1 mouse click.

Eclipse is missing powerfull features that Android Studio has

On toppic: You need to import the jars from the build config dialog, click import external jar and select your jar

tim687
  • 2,256
  • 2
  • 17
  • 28
  • Thanks for your sugesstion on Android Studio. try to work on that. But about importing external jars ; I have threid the method sugessted by you. And still getting run time error – Sidharth Dash Aug 03 '15 at 10:11
  • @SidharthDash Have you checked the export checkbox for your lib in the dialog? I don't know which one it was, but you need to select the library for export. Then it will be exported – tim687 Aug 03 '15 at 10:15
0

The library you added may need some external library eg google play services or something, do check that

pvn
  • 2,016
  • 19
  • 33