2016年9月12日 星期一

android error - java.lang.NoClassDefFoundError with AsyncHttpClient - API 19



java.lang.NoClassDefFoundError with AsyncHttpClient - API 19


Q : Process: com.example.gta.fab1, PID: 5775
            java.lang.NoClassDefFoundError: com.loopj.android.http.AsyncHttpClient
                at com.example.gta.fab1.TabFragments.WhoFragment.uploadToServer(WhoFragment.java:129)
                at com.example.gta.fab1.TabFragments.WhoFragment.access$100(WhoFragment.java:41)
                at com.example.gta.fab1.TabFragments.WhoFragment$1.onClick(WhoFragment.java:85)
                at com.facebook.FacebookButtonBase.callExternalOnClickListener(FacebookButtonBase.java:216)
                at com.facebook.share.widget.ShareButtonBase.access$000(ShareButtonBase.java:39)
                at com.facebook.share.widget.ShareButtonBase$1.onClick(ShareButtonBase.java:167)
                at com.facebook.FacebookButtonBase$1.onClick(FacebookButtonBase.java:385)
                at android.view.View.performClick(View.java:4438)
                at android.view.View$PerformClick.run(View.java:18422)
                at android.os.Handler.handleCallback(Handler.java:733)

A : Found it !! Its a waste of time using this library now, just notice that it running on API 23 and above !! WTF !!
Who needs library for 23 and above... sick, will search for a more reliable one.
Thanks to everyone that helped me on this issue.

A2: 
  1. Enable multidex
    defaultConfig {
    ...
     // Enabling multidex support.
    multiDexEnabled true
    }
  2. Add dependency
    dependencies {
        compile 'com.android.support:multidex:1.0.1'
    }
  3. Add codes in your application
    @Override
    protected void attachBaseContext(Context base) {
            super.attachBaseContext(base);
            MultiDex.install(this);
    }
That worked for me, i hope it is helpful for you.

沒有留言:

張貼留言