0

I am testing my app for the first on an android device (galaxy s3 mini) which has been tested several times in the emulator. The app contains a custom List View (DynamicListView: http://www.youtube.com/watch?v=_BZIvjMgH-Q). Code for this class with a demo app can be found here http://developer.android.com/shareables/devbytes/ListViewDraggingAnimation.zip

The extended listview class is in the same package as my main activity and added in the main activity layout, but after app is installed and about to start logcat prints that the class cannot be found. I've searched the web and don't seem to find a solution or even anyone with similar problem. I feel stuck with this problem as I don't really know how to go about fixing it and would appreciate any help offered.

The following is logged early on...

10-07 08:35:20.627: E/dalvikvm(16558): Could not find class 'com.amanda.tiara.DynamicListView$2', referenced from method com.amanda.tiara.DynamicListView.<clinit>

Followed later by... (take note of the last two lines)

10-07 08:32:39.443: E/AndroidRuntime(15341): FATAL EXCEPTION: main
10-07 08:32:39.443: E/AndroidRuntime(15341): java.lang.ExceptionInInitializerError
10-07 08:32:39.443: E/AndroidRuntime(15341):    at java.lang.Class.getDeclaredConstructors(Native Method)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at java.lang.Class.getConstructor(Class.java:503)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.createView(LayoutInflater.java:511)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:601)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:654)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.inflate(LayoutInflater.java:439)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.inflate(LayoutInflater.java:351)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.view.LayoutInflater.inflate(LayoutInflater.java:307)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:250)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.Activity.setContentView(Activity.java:1694)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at com.amanda.tiara.MainActivity.onCreate(MainActivity.java:40)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1699)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1754)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.ActivityThread.access$1500(ActivityThread.java:156)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1000)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.os.Handler.dispatchMessage(Handler.java:130)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.os.Looper.loop(SourceFile:351)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at android.app.ActivityThread.main(ActivityThread.java:3821)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at java.lang.reflect.Method.invokeNative(Native Method)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at java.lang.reflect.Method.invoke(Method.java:538)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727)
10-07 08:32:39.443: E/AndroidRuntime(15341):    at dalvik.system.NativeStart.main(Native Method)
10-07 08:32:39.443: E/AndroidRuntime(15341): Caused by: java.lang.NoClassDefFoundError: com.amanda.tiara.DynamicListView$2
10-07 08:32:39.443: E/AndroidRuntime(15341):    at com.amanda.tiara.DynamicListView.<clinit>(DynamicListView.java:517)
10-07 08:32:39.443: E/AndroidRuntime(15341):    ... 24 more

Edit

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //Remove title bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);

    lv = (DynamicListView)findViewById(R.id.mylist);

    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            DialogFragment ActionOptions = new ActionOptions();
            ActionOptions.show(getSupportFragmentManager(), "actions_options");

        }
    });
    lst = new ArrayList<AnActivity>();

    adp = new ActivityAdapter(this,lst);

    lv.mActivities = lst;

    lv.setAdapter(adp);
    adp.lv = lv;        //Adding internal reference for listview

    calc = (Button)findViewById(R.id.Calc);

    calc.setOnClickListener(new OnClickListener(){
        public void onClick(View v){
            DateTime begin = new DateTime();

            for (int i = 0; i < lst.size(); i++){
                lst.get(i).startTime = begin;
                begin = begin.plusHours(lst.get(i).duration.hours);
                begin = begin.plusMinutes(lst.get(i).duration.minutes);     
            }
            adp.notifyDataSetChanged();

        }
    });

    start_pause = (Button)findViewById(R.id.start_pause);

    start_pause.setOnClickListener(new OnClickListener(){
        public void onClick(View v){
            if (running)
                adp.pause();
            else
                adp.go();

            running = !running;
        }
    });

    Button list_actions = (Button) findViewById(R.id.list_actions);
    list_actions.setOnClickListener(new OnClickListener(){
        public void onClick(View v){
            showEditDialog();
        }}); 

}

Edit 2

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.amanda.tiara.DynamicListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingLeft="3dp" >

    <TextView
        android:id="@+id/Schedule"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="Calibri"
        android:text="Schedule"
        android:textSize="32dp" >
    </TextView>

    <Button
        android:id="@+id/list_actions"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Add" />

    <Button
        android:id="@+id/start_pause"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Start/Stop" />

    <Button
        android:id="@+id/Calc"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:text="C" />

</LinearLayout>

<com.appfactory.timemania.DynamicListView
    android:id="@+id/mylist"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#0000"
    android:footerDividersEnabled="true"
    android:headerDividersEnabled="true"
    android:paddingTop="10dp" />

cryptic'l
  • 43
  • 5
  • 1
    could you provide the interresting party of your MainActivity? – A.S. Oct 07 '13 at 08:54
  • Are you using ProGuard? The class may have been stripped out – Kuffs Oct 07 '13 at 08:55
  • No, I'm not using ProGuard – cryptic'l Oct 07 '13 at 10:06
  • @soma-web: I've edit the question and included all the code in onCreate. But the error is thrown at setContentView() – cryptic'l Oct 07 '13 at 14:23
  • and what is in there DynamicListView.java:517 and please show your main.xml – A.S. Oct 07 '13 at 14:26
  • @some-web: I've appended the activity_main layout in my new edit. Line 517 in DynamicListView is: `private final static TypeEvaluator sBoundEvaluator = new TypeEvaluator()` – cryptic'l Oct 07 '13 at 16:19
  • @Kuffs, Is there any other thing that could be the problem – cryptic'l Oct 08 '13 at 12:25
  • You have differing package names. com.appfactory.timemania.DynamicListView in your layout. com.amanda.tiara.DynamicListView in your error. Perhaps it is related to this but I cannot diagnose the issue with the information given. – Kuffs Oct 08 '13 at 12:37
  • @Kuffs, twas a mistake while posting the question. Corrected that but has no bearing on the problem. I wonder why the the logcat adds "$2" to the DynamicListView class name. – cryptic'l Oct 08 '13 at 16:32
  • The numeric suffix is an anonymous inner class. See this: http://stackoverflow.com/questions/11388840/java-compiled-classes-contain-dollar-signs – Kuffs Oct 09 '13 at 05:31

0 Answers0