Ausführung für Aufgabe „:app:checkDebugDuplicateClasses“ fehlgeschlagen. Ionic4-Android

Lesezeit: 7 Minuten

Benutzeravatar von Abdu4
Abdu4

Ich arbeite derzeit an einer ionic4-Anwendung, aber vor kurzem funktionierte sie nicht mehr, als ich die Anwendung nach dem Hinzufügen auf einem Android-Real-Gerät erstellte https://ionicframework.com/docs/native/fcm Plugin für die Anwendung.

Zuerst beschwerte es sich über Fabric Key, aber ich hatte nie vor, Fabric Crashlytic in meiner App zu verwenden.

Die Fehlerprotokolle:

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)

  Go to the documentation to learn how to <a href="https://stackoverflow.com/questions/56716047/d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 21s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
35 actionable tasks: 5 executed, 30 up-to-date
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)

  Go to the documentation to learn how to <a href="https://stackoverflow.com/questions/56716047/d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 21s
[ERROR] An error occurred while running subprocess cordova.

        cordova run android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

android/app/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' } // Fabrics Maven repository from cordova-plugin-firebase
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.4.0+'
        classpath 'com.google.gms:google-services:4.2.0' // google-services dependency from cordova-plugin-firebase
        classpath 'io.fabric.tools:gradle:1.+' // fabric dependency from cordova-plugin-firebase
    }
}

allprojects {
    repositories {

        jcenter()
        google() // Google's Maven repository from cordova-plugin-firebase
    }
    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="28" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

cordova-plugin-firebase/raihan-build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:3.4.0+'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}


dependencies {
    compile 'me.leolin:ShortcutBadger:1.1.4@aar'
    compile 'com.google.firebase:firebase-auth:+'
    compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
       transitive = true
    }
}
cdvPluginPostBuildExtras.add({
    // apply plugin: 'com.google.gms.google-services'
    apply plugin: 'io.fabric'
})

cordova-plugin-fcm-with-dependecy-updated/raihan-FCMPlugin.gradle

buildscript {
    repositories {
       google()
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0+'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}
repositories {
    google()
    jcenter()
}
dependencies {
    compile 'com.google.firebase:firebase-core:16.0.8'
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
// apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

android/project.properties

 target=android-27
    android.library.reference.1=CordovaLib
    android.library.reference.2=app
    cordova.gradle.include.1=cordova-android-support-gradle-release/raihan-cordova-android-support-gradle-release.gradle
    cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
    cordova.system.library.2=com.android.support:support-v4:24.1.1+
    cordova.system.library.3=com.soundcloud.android:android-crop:1.0.0@aar
    cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
    cordova.system.library.4=com.google.firebase:firebase-iid:17.1.1
    cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
    cordova.gradle.include.2=cordova-plugin-fcm-with-dependecy-updated/raihan-FCMPlugin.gradle
    cordova.gradle.include.3=cordova-support-google-services/raihan-build.gradle
    cordova.system.library.6=com.google.firebase:firebase-auth:16.2.0
    cordova.system.library.6=com.google.firebase:firebase-perf:16.2.4
    cordova.system.library.7=com.android.support:support-annotations:27.+
    cordova.system.library.8=com.android.support:appcompat-v7:23+
    cordova.system.library.8=com.google.firebase:firebase-iid:17.1.1
    cordova.system.library.8=com.google.android.gms:play-services-tagmanager:16.0.8
    cordova.system.library.8=com.google.firebase:firebase-config:16.4.0
    cordova.gradle.include.4=cordova-plugin-telerik-imagepicker/raihan-ignorelinterrors.gradle
    cordova.gradle.include.5=cordova-plugin-telerik-imagepicker/raihan-androidtarget.gradle
    cordova.gradle.include.6=cordova-android-support-gradle-release/raihan-cordova-android-support-gradle-release.gradle
    cordova.gradle.include.7=cordova-plugin-firebase/raihan-build.gradle

Ich habe die oben genannten Dateien bereitgestellt, lassen Sie mich wissen, wenn ich noch etwas hochladen muss.

  • Siehe ähnliche vollständige Antwort für weitere Details

    – Top-Master

    19. Juli 2021 um 15:23 Uhr


  • Vielen Dank, dass Sie android.enableJetifier=true hinzugefügt haben, hat es für mich behoben.

    – Neuer_Entwickler

    8. September 2022 um 5:13 Uhr

  • Das ist die Lösung, die für mich funktioniert hat, Sie haben meinen Tag gerettet.

    – Abdu4

    25. Juni 2019 um 4:16 Uhr

  • Eine Alternative, die für mich mit Cordova 8 funktioniert hat, besteht darin, die AndroidX-Unterstützung durch Hinzufügen zu aktivieren github.com/dpa99c/cordova-plugin-androidx und dann Hinzufügen von <github.com/dpa99c/cordova-plugin-androidx-adapter> was ein Shim ist, um die Abhängigkeiten zu aktualisieren

    – MStoner

    17. September 2019 um 11:26 Uhr

  • fügt hinzu, dass Sie die Ausgabe einfach zu einer Datei hinzufügen können, indem Sie dies tun ./gradlew :app:dependencies >> ~/output && code ~/output

    – Alita

    30. März 2022 um 3:41 Uhr


  • Ich werde dir nie genug danken können. Ich musste alle Androidx-Abhängigkeiten entfernen (die fast alle durch Firebase und ein paar andere Dinge verursacht wurden). Ich habe auch festgestellt, dass es viele Androidx-Abhängigkeiten der obersten Ebene gab (als ob ich sie eingeschlossen hätte), aber sie verschwanden, als ich Firebase deaktivierte. Sie sind eine Art “Reflexion”. Außerdem wird Multidex implizit von Android Studio verwendet, wenn „multiDexEnabled“ auf „true“ gesetzt ist. Verwenden Sie einfach den 1.0.3 Multidex, der nicht von Androidx abhängt. Spülen und wiederholen, bis Sie keine Androidx-Deps mehr haben, und dann sind Sie fertig

    – ci0ccarellia

    21. Juli 2022 um 16:00 Uhr


1442990cookie-checkAusführung für Aufgabe „:app:checkDebugDuplicateClasses“ fehlgeschlagen. Ionic4-Android

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy