【问题标题】:Android NoClassDefFoundError crash after new couchbase Lite Jars added添加新的 couchbase Lite Jars 后,Android NoClassDefFoundError 崩溃
【发布时间】:2015-09-24 21:20:52
【问题描述】:

在我使用 Gradle 或 jar 导入 Couchbase Lite Android 后发生了同样的崩溃。

无法真正弄清楚这里发生了什么,因为我没有接触代码,只是将 jar 放入“libs”文件夹中。

// inside Custom Application class
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());   // <===== Crash here!
}

追踪:

07-07 19:37:43.785  15247-15247/? E/AndroidRuntime﹕ 
FATAL EXCEPTION: main
Process: sg.com.bigspoon.www, PID: 15247
java.lang.NoClassDefFoundError: io.fabric.sdk.android.services.common.ExecutorUtils
        at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
        at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:197)
        at sg.com.bigspoon.www.data.BigSpoon.onCreate(BigSpoon.java:121)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4541)
        at android.app.ActivityThread.access$1500(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5292)
        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:828)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
        at dalvik.system.NativeStart.main(Native Method)

编辑:
虽然这是“固定的”。但是为什么会发生这种情况仍然很奇怪。我会启发我,我会将其标记为正确答案。

【问题讨论】:

    标签: android gradle couchbase crashlytics fabric.io


    【解决方案1】:

    这可以通过在 build.gradle 中启用 multiDex 来解决

    android {
    
         defaultConfig {
             // Lower than 14 doesn't support multidex
             minSdkVersion 14 
    
             // Enabling multidex support.
             multiDexEnabled true
         }
    }
    
    dependencies {
        compile 'com.android.support:multidex:1.0.1'
    }
    

    来源和更多细节 -->

    https://github.com/chrisjenx/Calligraphy/issues/136 https://developer.android.com/tools/building/multidex.html

    【讨论】:

    • 虽然这是“固定的”。但是为什么会发生这种情况仍然很奇怪。我会启发我,我会将其标记为正确答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 2019-07-12
    • 2017-02-01
    相关资源
    最近更新 更多