0

I have some jar libraries on which my app depends. When I copy and paste the jars in the project/libs folder, it builds, compiles and executes correctly.

However, if I right click my project -> Build path -> Configure build path -> Libraries tab -> Add external JARs, and add exactly the same jars, it still gives me no error, it allows me to build and compile, but when the app is executed it crashes.

Why?

Twinone
  • 2,949
  • 4
  • 28
  • 39

2 Answers2

1

If you put jars in libs folder it will automatically add those JARs to your compile-time build path. More importantly, it will put the contents of the JARs into your APK file, so they will be part of your run-time build path.

Adding jar to build path with lib manually will solve the compile-time problem, but then your JAR contents are not in your APK and therefore will not be available to you at runtime.

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
0

Don't use add external jar this will add as Absolute path instead of this use the relative path by adding jar, with this you must put all the jar files into the libs directory.

If you using Add External Jar it will search for that jar file based on Absolute path so on device that path was not find and you getting Force Close.

Try with adding same jar file by using Add Jar and Add External Jar option.

check the difference here https://stackoverflow.com/a/10679344/760489

Community
  • 1
  • 1
Pratik
  • 30,639
  • 18
  • 84
  • 159