my app is running fine in all the devices we have to test, but in a Galaxy S3 running Android 4.1.2 is failing during the start. In that device I am getting a NoClassDefFoundError in relation with a class, which, of course is there. I know the problem can be related too with the dependencies of that class. Here is the classes it is importing
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Iterator;
import javax.net.ssl.HttpsURLConnection;
Being I am using a lot of libraries I have multiDexEnabled = true in my Gradle file
I was reading a lot of posts but it is still unclear for me why some devices are throwing NoClassDefFoundError. Some people said this is a frequent issue on Samsung phones, but any case Samsung is not a brand to ignore. My intuition is the problem can be related with problems among libraries, but this point is very hard to debug.
Any help will be very welcomed ;-)
EDIT: The error log is:
04-01 11:37:15.927 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'io.realm.rx.RealmObservableFactory$4', referenced from method io.realm.rx.RealmObservableFactory.getObjectObservable
04-01 11:37:15.927 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'io.realm.rx.RealmObservableFactory$3', referenced from method io.realm.rx.RealmObservableFactory.getRealmResultsObservable
04-01 11:37:15.932 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'io.realm.rx.RealmObservableFactory$2', referenced from method io.realm.rx.RealmObservableFactory.from
04-01 11:37:15.937 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'io.realm.rx.RealmObservableFactory$1', referenced from method io.realm.rx.RealmObservableFactory.from
04-01 11:37:16.112 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'ie.aaireland.android.theaa.webservices.JSONConnection', referenced from method ie.aaireland.android.theaa.DataModel.<init>
04-01 11:37:16.112 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'ie.aaireland.android.theaa.DataModel$1', referenced from method ie.aaireland.android.theaa.DataModel.geocodeLookup
04-01 11:37:16.117 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'ie.aaireland.android.theaa.DataModel$TaskData', referenced from method ie.aaireland.android.theaa.DataModel.getTrafficRegions
04-01 11:37:16.117 31708-31708/ie.aaireland.android.theaa E/dalvikvm: Could not find class 'ie.aaireland.android.theaa.DataModel$2', referenced from method ie.aaireland.android.theaa.DataModel.run
04-01 11:37:16.117 31708-31708/ie.aaireland.android.theaa E/ACRA: ACRA caught a NoClassDefFoundError exception for ie.aaireland.android.theaa. Building report.
04-01 11:37:20.417 31708-31862/ie.aaireland.android.theaa E/ACRA: ie.aaireland.android.theaa fatal error : ie.aaireland.android.theaa.webservices.JSONConnection
java.lang.NoClassDefFoundError: ie.aaireland.android.theaa.webservices.JSONConnection
at ie.aaireland.android.theaa.DataModel.<init>(DataModel.java:92)
at ie.aaireland.android.theaa.TheAAApp.onCreate(TheAAApp.java:49)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1003)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4228)
at android.app.ActivityThread.access$1300(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
My dependencies:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/jsoup-1.8.3.jar')
compile "com.android.support:support-v4:${supportLibVersion}"
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okio:okio:1.0.1'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.pulsatehq.sdk:PulsateSdk:2.6.5'
And JSONConnection is an inherit class which is making a lot of JSON - Objects conversion (in both directions). And it is on my packages, I mean, is not belonging to any library
EDIT: My main intention basically is understand this kind of problems, what is happening. I mean, my App is using an third party SDK (Pulsate) whose libraries are clashing, and repeat just in this device, with two libraries used by Retrofit (my App is using Retrofit). Exactly the same APK run smoothly in other newer Samsung devices. The Pulsate libraries are crashing are Dagger and Realm. Will be wonderful if some wise developer can enlighten us.