0

Whenever I try using a Fragment that utilizes the android-betterpickers library, I get the following error.

I have my projected pointed to the android-betterpickers as a library for my project. Anyone know what may be going on here?

08-10 02:06:39.152: E/AndroidRuntime(2628): java.lang.NoClassDefFoundError: com.mavdev.focusoutfacebook.fragments.addablock.selecttime.Fragment_time_addblock
08-10 02:06:39.152: E/AndroidRuntime(2628):     at com.mavdev.focusoutfacebook.fragments.addablock.Fragment_AddaBlock.displayView(Fragment_AddaBlock.java:224)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at com.mavdev.focusoutfacebook.fragments.addablock.Fragment_AddaBlock.access$0(Fragment_AddaBlock.java:211)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at com.mavdev.focusoutfacebook.fragments.addablock.Fragment_AddaBlock$ListItemClickListener.onItemClick(Fragment_AddaBlock.java:293)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.widget.AdapterView.performItemClick(AdapterView.java:298)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:2788)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.widget.AbsListView$1.run(AbsListView.java:3463)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.os.Handler.handleCallback(Handler.java:730)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.os.Looper.loop(Looper.java:137)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at android.app.ActivityThread.main(ActivityThread.java:5103)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at java.lang.reflect.Method.invokeNative(Native Method)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at java.lang.reflect.Method.invoke(Method.java:525)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-10 02:06:39.152: E/AndroidRuntime(2628):     at dalvik.system.NativeStart.main(Native Method)

I am just extending one of the classes of android-betterpickers from one of my Fragments, shown below, just not showing the other functions like the onCreateView in the Fragment:

public class Fragment_time_addblock extends Fragment DatePickerDialogHandler {


@Override
public void onDialogDateSet(int reference, int year, int monthOfYear,
        int dayOfMonth) {
    // TODO Auto-generated method stub

}


}

The issue happens ONLY when run on a phone/emulator, but able to compile the project and run it successfully, only when I try to open this Fragment, the app crashes.

enter image description here

What can I try to fix this issue?

user1406716
  • 9,565
  • 22
  • 96
  • 151

2 Answers2

2

Check if you have that library exported in Java Build Path > Order and Export tab

bhargavg
  • 1,383
  • 9
  • 12
  • I have it, added screenshot in the question. The issue happens ONLY when run on a phone/emulator, but able to compile the project and run it successfully, only when I try to open this Fragment, the app crashes. Really not sure what is going on here ... – user1406716 Aug 10 '14 at 07:43
  • 1
    From the above screenshot, i doubt the .jar file is not in `libs` folder. You need to have all your `.jar`s in `libs`, otherwise it wont be packed in apk – bhargavg Aug 10 '14 at 07:57
  • do i need to generate *.jar file for the "libraryDateTimePicker" library project? How? It is an external library project with source code that i am trying to use. – user1406716 Aug 10 '14 at 08:02
0

hate answering my own question, but i will pen down what i did, not the most elegant solution

I copied the right classes and interfaces from the Library into my own project. The issue I think is something to do with cross dependencies as I am using several libraries that reference some other common libraries.

Bringing the code into my own project also allows me to keep the size of the apk reasonably small.

user1406716
  • 9,565
  • 22
  • 96
  • 151