0

I have problems when I add my own library to my project . I have use Twitter and Facebook library and its work fine . When I try to use my own lib . Its getting error

I have try many way but it have same error . This is Order and Export Tab

enter image description here

In logcat

06-13 08:43:21.774: E / AndroidRuntime (808): FATAL EXCEPTION: main 06-13 08:43:21.774: E / AndroidRuntime (808): java.lang.NoClassDefFoundError: thanhnd.app.SQLDataHelper 06-13 08:43:21.774: E / AndroidRuntime (808): at com.example.searchbar.MainActivity.onCreate (MainActivity.java: 34) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.Activity.performCreate (Activity.java: 5104) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java: 1080) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2144) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2230) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.ActivityThread.access $ 600 (ActivityThread.java: 141) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 1234) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.os.Handler.dispatchMessage (Handler.java: 99) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.os.Looper.loop (Looper.java: 137) 06-13 08:43:21.774: E / AndroidRuntime (808): at android.app.ActivityThread.main (ActivityThread.java: 5041) 06-13 08:43:21.774: E / AndroidRuntime (808): at java.lang.reflect.Method.invokeNative (Native Method) 06-13 08:43:21.774: E / AndroidRuntime (808): at java.lang.reflect.Method.invoke (Method.java: 511) 06-13 08:43:21.774: E / AndroidRuntime (808): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 793) 06-13 08:43:21.774: E / AndroidRuntime (808): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 560) 06-13 08:43:21.774: E / AndroidRuntime (808): at dalvik.system.NativeStart.main (Native Method)

Please give me some advice !!!

Swift Sharp
  • 2,604
  • 3
  • 30
  • 54
Nam Nguyen
  • 317
  • 4
  • 18

2 Answers2

0

please just renamed lib to libs and updated the references on the java build path.

project right click properties-> Java BuildPath select Library and add external .jar the follow these step.

Go to Project->Properties->Java Build Path than select Order and export tab. Set external .jar library checked and up it into top of the list. And clean and rebuild..It works for most of the cases

Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
  • My lib has already libs . I have added by the way click library > properties > Java BuildPath . But I get same error . The same way work for Twitter and Facebook library . It doesn't require any thing else . – Nam Nguyen Jun 13 '13 at 09:16
0

You have to set the Java compiler compliance level to Java 1.6. Android tooling cannot cope with Java 7 class files and thus doesn't dex your file.

Go to Properties -> Java Compiler -> JDK-Compliance

Switch here to 1.6

Wolfram Rittmeyer
  • 2,402
  • 1
  • 18
  • 21