Reputation: 113
My team has encountered a strange error where our android application will crash only when we try to run the app on our Galaxy SIII test phone. It works fine on our other two test phones (an S6 and a DROID).
The app crashes at runtime with an unhandled exception because it is not able to locate some of the classes referenced in joda-time -- a project dependency that we declare in our build.gradle. Again, this error only happens on our S3, and even then it was working up until about two weeks ago.
With this type of issue there are many ways I can move forward to figure out what's wrong. I'm starting to hit a wall, though, and would love any ideas/suggestions on what could be the issue.
Edit2: We identified the issue. We were not correctly instantiating multidex support and the class was not loading.
Edit: Logcat below
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/joda/time/format/DateTimeFormatterBuilder;)
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/joda/time/format/DateTimeFormatterBuilder;)
E/dalvikvm: Could not find class 'org.joda.time.format.DateTimeFormat$StyleFormatter', referenced from method org.joda.time.format.DateTimeFormat.createDateTimeFormatter
W/dalvikvm: VFY: unable to resolve new-instance 9443 (Lorg/joda/time/format/DateTimeFormat$StyleFormatter;) in Lorg/joda/time/format/DateTimeFormat;
D/dalvikvm: VFY: replacing opcode 0x22 at 0x0005
E/dalvikvm: Could not find class 'org.joda.time.format.DateTimeFormatterBuilder', referenced from method org.joda.time.format.DateTimeFormat.createFormatterForPattern
W/dalvikvm: VFY: unable to resolve new-instance 9447 (Lorg/joda/time/format/DateTimeFormatterBuilder;) in Lorg/joda/time/format/DateTimeFormat;
D/dalvikvm: VFY: replacing opcode 0x22 at 0x001a
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/joda/time/format/DateTimeFormatterBuilder;)
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendEraText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65094: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendEraText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x003c
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendCenturyOfEra, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65086: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendCenturyOfEra (II)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0042
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTwoDigitYear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65113: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTwoDigitYear (IZ)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0075
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTwoDigitWeekyear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65112: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTwoDigitWeekyear (IZ)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0084
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendYearOfEra, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65117: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendYearOfEra (II)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00ab
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendWeekyear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65115: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendWeekyear (II)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00af
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendYear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65116: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendYear (II)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00b3
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendMonthOfYearText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65104: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendMonthOfYearText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00bd
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendMonthOfYearShortText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65103: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendMonthOfYearShortText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00c2
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendMonthOfYear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65102: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendMonthOfYear (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00c7
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendDayOfMonth, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65089: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendDayOfMonth (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00cc
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendHalfdayOfDayText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65096: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendHalfdayOfDayText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00d1
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendClockhourOfHalfday, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65088: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendClockhourOfHalfday (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00d6
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendHourOfDay, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65097: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendHourOfDay (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00db
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendClockhourOfDay, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65087: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendClockhourOfDay (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00e0
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendHourOfHalfday, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65098: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendHourOfHalfday (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00e5
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendMinuteOfHour, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65101: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendMinuteOfHour (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00ea
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendSecondOfMinute, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65106: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendSecondOfMinute (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00ef
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendFractionOfSecond, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65095: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendFractionOfSecond (II)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00f4
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendDayOfWeek, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65090: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendDayOfWeek (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00f9
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendDayOfWeekText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65092: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendDayOfWeekText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0101
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendDayOfWeekShortText, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65091: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendDayOfWeekShortText ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0106
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendDayOfYear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65093: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendDayOfYear (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x010b
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendWeekOfWeekyear, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65114: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendWeekOfWeekyear (I)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0110
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTimeZoneName, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65108: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTimeZoneName ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0118
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTimeZoneShortName, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65111: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTimeZoneShortName (Ljava/util/Map;)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x011e
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTimeZoneOffset, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65109: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTimeZoneOffset (Ljava/lang/String;Ljava/lang/String;ZII)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x74 at 0x012d
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTimeZoneOffset, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65109: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTimeZoneOffset (Ljava/lang/String;Ljava/lang/String;ZII)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x74 at 0x013c
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendTimeZoneId, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65107: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendTimeZoneId ()Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0141
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendLiteral, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65099: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendLiteral (C)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0157
I/dalvikvm: Could not find method org.joda.time.format.DateTimeFormatterBuilder.appendLiteral, referenced from method org.joda.time.format.DateTimeFormat.parsePatternTo
W/dalvikvm: VFY: unable to resolve virtual method 65100: Lorg/joda/time/format/DateTimeFormatterBuilder;.appendLiteral (Ljava/lang/String;)Lorg/joda/time/format/DateTimeFormatterBuilder;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0161
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/joda/time/format/InternalPrinter;)
E/dalvikvm: Could not find class 'org.joda.time.format.DateTimeFormat$StyleFormatter', referenced from method org.joda.time.format.DateTimeFormat.patternForStyle
W/dalvikvm: VFY: unable to resolve check-cast 9443 (Lorg/joda/time/format/DateTimeFormat$StyleFormatter;) in Lorg/joda/time/format/DateTimeFormat;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x000e
D/dalvikvm: DexOpt: unable to opt direct call 0xfdef at 0x07 in Lorg/joda/time/format/DateTimeFormat;.createDateTimeFormatter
D/dalvikvm: DexOpt: unable to opt direct call 0xfe3d at 0x1c in Lorg/joda/time/format/DateTimeFormat;.createFormatterForPattern
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41799da0)
D/HockeyApp: Writing unhandled exception to: /data/data/advancetransit.advancetransit/files/ca1894c1-c19a-49ea-acbe-bf74fc934521.stacktrace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: advancetransit.advancetransit, PID: 6151
java.lang.NoClassDefFoundError: org.joda.time.format.DateTimeFormatterBuilder
at org.joda.time.format.DateTimeFormat.createFormatterForPattern(DateTimeFormat.java:686)
at org.joda.time.format.DateTimeFormat.forPattern(DateTimeFormat.java:177)
at advancetransit.advancetransit.models.StopTime.timeDifference(StopTime.java:116)
at advancetransit.advancetransit.ui.activities.MainActivity.onStopSelect(MainActivity.java:1678)
at advancetransit.advancetransit.ui.activities.MainActivity$GetLiveData.onPostExecute(MainActivity.java:970)
at advancetransit.advancetransit.ui.activities.MainActivity$GetLiveData.onPostExecute(MainActivity.java:785)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
01-28 16:47:38.974 6151-6158/advancetransit.advancetransit I/AndroidRuntime: VM exiting with result code 1, cleanup skipped.
Upvotes: 3
Views: 249
Reputation: 1200
Changing from standard JodaTime to Android port of JodaTime does not solve the issue. As explained by @coder-con, the issue is relative to MultiDex support not correctly setup. To setup multidex, you need (as explained in Android Developer) :
Edit your build.gradle
and add mutliDexEnabled true
and compile 'com.android.support.multidex:1.01'
:
android {
...
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
In your AndroidManifest.xml
, set the application name to android.support.multidex.MultiDexApplication
if you do not have your own application class. Otherwise, either extend this class, or override attachBaseContext
like this: (See details here)
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
Upvotes: 1