ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.14k stars 1.01k forks source link

bug: Duplicate class error at building the apk #5733

Closed BalaclavaAM closed 2 years ago

BalaclavaAM commented 2 years ago

Bug Report

Capacitor Version

  @capacitor/android: 3.6.0
  @capacitor/core: 3.6.0
  @capacitor/ios: 3.6.0
  @capacitor/cli: 3.6.0

Platform(s)

Android

Current Behavior

When I try to compile the app, it generates me the following error in android studio:

Duplicate class android.support.v4.media.MediaMetadataCompat found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$1 found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$Builder found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompatApi21 found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompatApi21$Builder found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.RatingCompat found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.RatingCompat$1 found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$StubApi21 found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImpl found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21 found in modules jetified-android-support-v4 (android-support-v4.jar) and media-1.0.0-runtime (androidx.media:media:1.0.0)
....

Go to the documentation to learn how to Fix dependency resolution errors.

full log: here

Expected Behavior

I expect to be able to generate the APK. It seems to me that the problems are related to the Awesome-cordova-plugins.

To generate the APK I changed the line

cordovaAndroidVersion = '7.0.0' to cordovaAndroidVersion = '10.1.2'

in android/variables.gradle

Code Reproduction

My package.json:

  "dependencies": {
    "@angular/common": "~13.3.11",
    "@angular/compiler": "~13.3.11",
    "@angular/core": "~13.3.11",
    "@angular/forms": "~13.3.11",
    "@angular/platform-browser": "~13.3.11",
    "@angular/platform-browser-dynamic": "~13.3.11",
    "@angular/router": "~13.3.11",
    "@awesome-cordova-plugins/app-version": "5.43.0",
    "@awesome-cordova-plugins/core": "5.43.0",
    "@awesome-cordova-plugins/document-viewer": "5.43.0",
    "@awesome-cordova-plugins/file": "5.43.0",
    "@awesome-cordova-plugins/file-opener": "5.43.0",
    "@awesome-cordova-plugins/file-transfer": "^5.43.0",
    "@awesome-cordova-plugins/firebase-x": "5.43.0",
    "@awesome-cordova-plugins/in-app-browser": "5.43.0",
    "@awesome-cordova-plugins/market": "5.43.0",
    "@awesome-cordova-plugins/network-interface": "5.43.0",
    "@awesome-cordova-plugins/splash-screen": "^5.43.0",
    "@awesome-cordova-plugins/status-bar": "^5.43.0",
    "@capacitor/android": "3.6.0",
    "@capacitor/cli": "^3.6.0",
    "@capacitor/core": "^3.6.0",
    "@capacitor/ios": "^3.6.0",
    "@capacitor/push-notifications": "^1.0.9",
    "@capacitor/splash-screen": "^1.2.2",
    "@capacitor/status-bar": "^1.0.8",
    "@ionic/angular": "^6.1.12",
    "@ionic/cli": "^6.20.1",
    "@ionic/storage": "^3.0.6",
    "@ionic/storage-angular": "^3.0.6",
    "@popperjs/core": "^2.11.5",
    "android.support.v4": "21.0.1",
    "bootstrap": "^5.1.3",
    "capacitor-resources": "^2.0.3",
    "chart.js": "^2.9.3",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-bb-app": "1.0.1",
    "cordova-plugin-file-transfer": "github:apache/cordova-plugin-file-transfer",
    "cordova-plugin-networkinterface": "^2.2.0",
    "cordova-plugin-splashscreen": "^6.0.1",
    "cordova-plugin-statusbar": "^3.0.0",
    "cordova-sqlite-storage": "^6.0.0",
    "countdown": "^2.6.0",
    "jetifier": "^2.0.0",
    "jquery": "^3.6.0",
    "ngx-pipes": "^3.0.0",
    "npm": "^8.13.1",
    "recaptcha-v3": "^1.8.0",
    "rxjs": "^6.6.7",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.6"
  }

Other Technical Details

npm --version output: 8.10.0 node --version output: v16.15.0 pod --version output (iOS issues only):

Additional Context

Ionitron commented 2 years ago

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks! Ionitron 💙

Ionitron commented 2 years ago

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day! Ionitron 💙

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.