I’ve an app that uses the android-support-v4.jar. This jar is on the build path in eclipse. If i right click on the package and configure build path, it is present there as a library. In the source code i can use it and eclipse knows what it is, but if i run the app i get this runtime error
01-13 15:39:51.838: E/AndroidRuntime(12398): FATAL EXCEPTION: main
01-13 15:39:51.838: E/AndroidRuntime(12398): java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager
01-13 15:39:51.838: E/AndroidRuntime(12398): at com.carefreegroup.NfcscannerActivity.processTagWithGPS(NfcscannerActivity.java:1568)
01-13 15:39:51.838: E/AndroidRuntime(12398): at com.carefreegroup.NfcscannerActivity.onActivityResult(NfcscannerActivity.java:1742)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.Activity.dispatchActivityResult(Activity.java:4747)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.ActivityThread.deliverResults(ActivityThread.java:3394)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3448)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.ActivityThread.access$1100(ActivityThread.java:139)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.os.Handler.dispatchMessage(Handler.java:99)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.os.Looper.loop(Looper.java:156)
01-13 15:39:51.838: E/AndroidRuntime(12398): at android.app.ActivityThread.main(ActivityThread.java:4987)
01-13 15:39:51.838: E/AndroidRuntime(12398): at java.lang.reflect.Method.invokeNative(Native Method)
01-13 15:39:51.838: E/AndroidRuntime(12398): at java.lang.reflect.Method.invoke(Method.java:511)
01-13 15:39:51.838: E/AndroidRuntime(12398): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-13 15:39:51.838: E/AndroidRuntime(12398): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-13 15:39:51.838: E/AndroidRuntime(12398): at dalvik.system.NativeStart.main(Native Method)
Has anybody any ideas why? Thanks in advance.
If you did this by manually fiddling with the build path, that is the source of your difficulty. Put the JAR in
libs/of your project and undo your build path change. Everything inlibs/is automatically added to your compile build path and is packaged into your APK for distribution to the device.