我如何修复NoClassDefFoundError和DexPath错误

时间:2016-10-28 08:54:34

标签: android

我是一位非常新的Android开发者。我'与其他几个人一起开展项目,我们使用GitHub进行协作。给我一个错误的特定应用程序不会在任何其他手机上运行,​​因此我已经完成了修复它的任务。问题出在这里:当我在手机上运行应用程序时,它会崩溃......这是错误:

 java.lang.NoClassDefFoundError:
 Failed resolution of: Lcom/crashlytics/android/Crashlytics;

并且logcat上的第二个错误是:

 java.lang.ClassNotFoundException:
 Didn't find class "com.crashlytics.android.Crashlytics"
 on path: DexPathList[[dex fil

...ë

我尝试在线搜索,但在gradle文件夹中启用Multidex的建议似乎没有帮助。

感谢名单

这是我的gradle文件...

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}
android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/gen_approx_cyrillic.txt'
    }
    defaultConfig {
        applicationId "com.aftarobot.assocbuilder"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 7
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
        resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.3'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    //    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
            {
                exclude group: 'com.android.support', module: 'support-annotations'
            })
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    //    compile project(path: ':aftarobotbackend', configuration: 'android-endpoints')
    //    compile project(path: ':xbackend', configuration: 'android-endpoints')
    compile project(':aftarobotlibrary')
    compile 'com.google.code.findbugs:jsr305:2.0.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    testCompile 'junit:junit:4.10'
}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

嗨,大家好。我修好了。我最终去了GitHub的主分支并复制了该版本的清单并且它有效。我没有必要更改gradle文件中的任何内容