NoClassDefFoundError: ошибка при генерации apk - PullRequest
0 голосов
/ 20 июня 2019

перенести мое приложение на android x и gradle 5 момент, когда я отправляю генерировать apk или установить, дает мне эту ошибку

Причина: java.lang.NoClassDefFoundError: com / android / tools / r8 / dex / ApplicationReader

Build.graddle

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

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

    google()
}


android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
        applicationId "gortiz.com.goapp"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 37
        versionName '2.0.37'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}




dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')


    implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true;
    }
    implementation 'androidx.appcompat:appcompat:1.+'

    implementation 'androidx.vectordrawable:vectordrawable-animated:1.+'


    implementation 'androidx.mediarouter:mediarouter:1.+'

    implementation 'androidx.core:core:1.+'


    implementation 'androidx.multidex:multidex:2.+'
    implementation 'com.google.android.material:material:1.+'
    implementation 'commons-io:commons-io:2.5'
    implementation 'androidx.constraintlayout:constraintlayout:1.+'
    implementation 'androidx.legacy:legacy-support-v4:1.+'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.github.satyan:sugar:1.5'
    implementation 'com.squareup.picasso:picasso:2.5.0'

    implementation 'me.panavtec:wizard:1.2'
    implementation 'com.github.johnkil.print:print:1.2.+'
    implementation 'com.github.bmelnychuk:atv:1.2.+'

    implementation 'androidx.legacy:legacy-support-v13:1.0.0'

     testImplementation 'junit:junit:4.12'
    implementation 'androidx.recyclerview:recyclerview:1.+'


    implementation ('com.google.firebase:firebase-messaging:17.3.4'){
        exclude group: 'com.google.firebase', module: 'firebase-iid'
    }
    implementation 'com.google.android.gms:play-services-maps:17.+'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.android.gms:play-services-base:16.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.android.gms:play-services-vision:18.+'
    implementation 'com.google.firebase:firebase-config:18.+'
    implementation 'com.google.firebase:firebase-iid:17.0.2'
    implementation 'androidx.annotation:annotation:1.1.0'





}



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

graddle.properties

org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true

Причина: java.lang.NoClassDefFoundError: com / android / tools / r8 / dex / ApplicationReader

1 Ответ

0 голосов
/ 21 июня 2019

На верхнем уровне build.gradle отсутствует зависимость от плагина Android Gradle.Пожалуйста, добавьте что-то вроде этого (в зависимости от версии, которую вы хотели бы использовать):

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        ...
    }
    ...
}

Если вы создаете пустой проект в Android Studio, то все должно быть на месте.

...