I'm trying to build the Android app and getting this output error:
BUILD FAILED in 39s
/Users/myuser/dev/myapp/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Program type already present: com.google.zxing.BarcodeFormat
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: com.google.zxing.BarcodeFormat
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Things I tried according internet search results:
cordova clean
+cordova build
- remove android platform and add it again
- clone repository in another place and build it from scratch
So the same error keeps happening.
Here is my package.json
file for reference:
{
"name": "myapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/app-rate": "^5.19.0",
"@ionic-native/app-version": "^5.17.1",
"@ionic-native/badge": "^5.17.1",
"@ionic-native/barcode-scanner": "^5.17.1",
"@ionic-native/call-number": "^5.19.1",
"@ionic-native/core": "^5.0.0",
"@ionic-native/device": "^5.17.1",
"@ionic-native/diagnostic": "^5.17.1",
"@ionic-native/facebook": "^5.19.1",
"@ionic-native/firebase": "^5.18.0",
"@ionic-native/firebase-x": "^5.18.0",
"@ionic-native/geolocation": "^5.17.1",
"@ionic-native/google-maps": "^5.0.0-beta.27",
"@ionic-native/keyboard": "^5.19.1",
"@ionic-native/launch-navigator": "^5.19.1",
"@ionic-native/network": "^5.17.1",
"@ionic-native/screen-orientation": "^5.17.1",
"@ionic-native/splash-screen": "^5.17.1",
"@ionic-native/status-bar": "^5.17.1",
"@ionic-native/unique-device-id": "^5.19.0",
"@ionic/angular": "^4.7.1",
"@ionic/storage": "^2.2.0",
"call-number": "^1.0.1",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-apprate": "^1.5.0",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-facebook4": "^6.2.0",
"cordova-plugin-firebase": "^2.0.5",
"cordova-plugin-firebasex": "^7.0.1",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-googlemaps": "^2.6.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "~2.4.2",
"cordova-plugin-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "~1.3.3",
"cordova-support-android-plugin": "^1.0.1",
"cordova-support-google-services": "^1.3.2",
"cordova.plugins.diagnostic": "^5.0.1",
"core-js": "^2.5.4",
"es6-promise-plugin": "^4.2.2",
"ionicons": "git://github.com/ionic-team/ionicons.git#3.0",
"ios-sim": "^8.0.2",
"mx.ferreyra.callnumber": "0.0.2",
"ngx-mask-ionic": "^1.1.2",
"phonegap-plugin-barcodescanner": "^8.1.0",
"rxjs": "~6.5.1",
"rxjs-compat": "^6.5.3",
"tslib": "^1.9.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "~8.1.2",
"@angular-devkit/schematics": "~8.1.2",
"@angular/cli": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-app-version": {},
"cordova-plugin-network-information": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-geolocation": {},
"cordova.plugins.diagnostic": {
"ANDROID_SUPPORT_VERSION": "28.+"
},
"cordova-plugin-badge": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
"ANDROID_ICON_ACCENT": "#FF00FFFF",
"ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
"ANDROID_FIREBASE_ANALYTICS_VERSION": "17.2.1",
"ANDROID_FIREBASE_MESSAGING_VERSION": "20.0.0",
"ANDROID_FIREBASE_CONFIG_VERSION": "19.0.3",
"ANDROID_FIREBASE_PERF_VERSION": "19.0.1",
"ANDROID_FIREBASE_AUTH_VERSION": "19.1.0",
"ANDROID_CRASHLYTICS_VERSION": "2.10.1",
"ANDROID_CRASHLYTICS_NDK_VERSION": "2.1.1"
},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-uniquedeviceid": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-apprate": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"GOOGLE_API_KEY_FOR_ANDROID": "AIzaSyDb5ggUt5U1vXF2RSVHvtecnX-xv36Lays",
"OKHTTP_VERSION": "3.12.0",
"LOCATION_USAGE_DESCRIPTION": "Veja estabelecimentos mais próximos de você com dinheiro de volta"
},
"mx.ferreyra.callnumber": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "AIzaSyDb5ggUt5U1vXF2RSVHvtecnX-xv36Lays",
"API_KEY_FOR_IOS": "AIzaSyDb5ggUt5U1vXF2RSVHvtecnX-xv36Lays",
"PLAY_SERVICES_VERSION": "15.0.1",
"ANDROID_SUPPORT_V4_VERSION": "27.+",
"LOCATION_WHEN_IN_USE_DESCRIPTION": "Somente utilizamos a sua localização quando o app estiver aberto",
"LOCATION_ALWAYS_USAGE_DESCRIPTION": "This app wants to get your location always, even this app runs in background."
},
"call-number": {},
"cordova-plugin-facebook4": {
"APP_ID": "573564436804950",
"APP_NAME": "myapp",
"FACEBOOK_HYBRID_APP_EVENTS": "true",
"FACEBOOK_ANDROID_SDK_VERSION": "5.5.2"
},
"cordova-plugin-androidx": {},
"cordova-plugin-compat": {},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
},
"platforms": [
"android"
]
}
}
Possible conflicting plugins (from my package.json)
A few answers tells about conflicting plugins managing android/firebase versions. So maybe using all these libs/plugins can be the problem?
npm
- @ionic-native/firebase-x
- cordova-android-support-gradle-release
- cordova-plugin-androidx
- cordova-plugin-androidx-adapter
- cordova-plugin-firebasex
- cordova-support-android-plugin
cordova plugins
- cordova-plugin-firebasex
- cordova-plugin-androidx-adapter
- cordova-plugin-androidx
- cordova-plugin-compat
- cordova-android-support-gradle-release
What else can I try to solve that? It's been 2 days spent on this issue :(