Android 应用仅在 Galaxy SIII 上崩溃

标签 android

我的团队遇到了一个奇怪的错误,只有当我们尝试在我们的 Galaxy SIII 测试手机上运行该应用程序时,我们的 android 应用程序才会崩溃。它在我们的其他两款测试手机(S6 和 DROID)上运行良好。

应用程序在运行时崩溃并出现未处理的异常,因为它无法找到 joda-time 中引用的某些类-- 我们在 build.gradle 中声明的项目依赖项。同样,此错误发生在我们的 S3 上,即使如此,直到大约两周前它仍在运行。

对于此类问题,我可以通过多种方式继续找出问题所在。不过,我开始碰壁了,希望就可能出现的问题提出任何想法/建议。

Edit2:我们发现了这个问题。我们没有正确实例化 multidex 支持,并且没有加载该类。

编辑:下面的 Logcat

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.

最佳答案

从标准 JodaTime 更改为 JodaTime 的 Android 端口并不能解决问题。 正如@coder-con 所解释的那样,该问题与未正确设置 MultiDex 支持有关。 要设置 multidex,您需要(如 Android Developer 中所述):

  1. 编辑您的 build.gradle 并添加 mutliDexEnabled truecompile 'com.android.support.multidex:1.01':

    android {
        ...
        defaultConfig {
            ...
            // Enabling multidex support.
            multiDexEnabled true
        }
    ...
    }
    dependencies {
        compile 'com.android.support:multidex:1.0.1'
    }
    
  2. 如果您没有自己的应用程序类,请在您的 AndroidManifest.xml 中将应用程序名称设置为 android.support.multidex.MultiDexApplication。否则,要么扩展此类,要么像这样覆盖 attachBaseContext:( See details here )

    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    

关于Android 应用仅在 Galaxy SIII 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35261330/

相关文章:

安卓电视模拟器 : No Internet Access

android - RxJava 在单个订阅者中观察多个观察者

java - Twitter4J.Status 与 android.os.AsyncTask.Status 冲突?

android - Flutter 修复 FlatButton 中不同图片大小相同的问题

android - 使用 Google IAB 显示产品的设备特定定价

android - 在官方 Android 模拟器上安装 ARM Translation (libhoudini)

android - fragment 被销毁后停止处理程序

java - Android 中的 Java 树结构错误

android - 在 onLoadFinished() 期间合并游标会在旋转后导致 StaleDataException

android - 使用 RxJava 测试 Android Realm - "opened from a thread without a Looper"异常