Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: npx cap sync android breaks the ./gradlew bundleRelease #5820

Closed
prosidney opened this issue Aug 2, 2022 · 7 comments · Fixed by #5827
Closed

bug: npx cap sync android breaks the ./gradlew bundleRelease #5820

prosidney opened this issue Aug 2, 2022 · 7 comments · Fixed by #5827

Comments

@prosidney
Copy link

prosidney commented Aug 2, 2022

Bug Report

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 4.0.1
@capacitor/core: 4.0.1
@capacitor/android: 4.0.1

[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

After upgrade to capacitor 4, everytime I run npx cap sync android, the cli is changing 2 lines on both build.gradle (reference below) in a way that my next command ("./gradlew bundleRelease") won't run.

android/app/capacitor.build.gradle
android/capacitor-cordova-android-plugins/build.gradle

Output after running ./gradlew bundleRelease

  • What went wrong:
    Execution failed for task ':app:checkReleaseDuplicateClasses'.

Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
Could not find platform('com.google.firebase:firebase-bom:30.3.1').
Required by:
project :app
project :app > project :capacitor-cordova-android-plugins
Could not find com.google.firebase:firebase-analytics:.
Required by:
project :app
project :app > project :capacitor-cordova-android-plugins

Expected Behavior

The lines should be like this

implementation platform('com.google.firebase:firebase-bom:30.3.1')

instead of

implementation "platform('com.google.firebase:firebase-bom:30.3.1')"

if I change it manually afterwards, it works.

Code Reproduction

The problem starts when adding cordova-plugin-firebase-* dependencies which include the Firebase Android BoM (Bill of Materials) ( I have many ).

I've created a minimal reproduction here:
https://github.com/prosidney/reproduce-ionic-platform-issue

Other Technical Details

npm --version output: 8.15.0

node --version output: v18.7.0

pod --version output (iOS issues only):

Additional Context

Firebase Android BoM (Bill of Materials)
https://firebase.google.com/docs/android/learn-more#bom

@jcesarmobile
Copy link
Member

I've been testing and it wasn't working on Capacitor 3 neither, using bom dependencies was not supported on cordova until cordova-android 11, released less than a month ago.
It breaks now because you have updated to cordova-plugin-firebase-config 7.0.1, which was released 2 days ago and uses bom now.
You can downgrade the plugin to version 6.1.0 until we fix the issue.

@iamromec
Copy link

iamromec commented Aug 5, 2022

Even if I downgrade to 6.1.0, it breaks and throws the following error on the app launch.

"java.lang.RuntimeException: Cordova method createChannel does not have valid parameters"

Screenshot 2022-08-05 at 6 01 21 PM

@prosidney
Copy link
Author

@iamromec , just FYI, when I downgrade the cordova plugin, it worked on my end.

@iamromec
Copy link

iamromec commented Aug 6, 2022

@priyankpat I need to use the firebase messaging plugin, not cordova-plugin-firebase-config.

Have you installed messaging plugin?

@iamromec
Copy link

iamromec commented Aug 6, 2022

Also, @prosidney, could you share your package.json file, please? I'm using the latest ionic with angular.

@prosidney
Copy link
Author

prosidney commented Aug 6, 2022

sure,

{
  "name": "mypromille",
  "version": "3.10.12",
  "author": "Sidney Assis",
  "homepage": "https://landing.mypromille.com/",
  "engines": {
    "node": "16.x",
    "npm": "8.x"
  },
  "scripts": {
    "ng": "ng",
    "start": "node dist/app/server/main.js",
    "build": "ng build",
    "test": "ng test --code-coverage true",
    "lint": "ng lint",
    "resources": "cordova-res android --skip-config --copy",
    "sonar": "sonar-scanner -Dsonar.projectVersion=${APP_VERSION}",
    "test-ci": "ng test --watch=false --code-coverage",
    "e2e": "ng e2e",
    "dev:ssr": "ng run app:serve-ssr",
    "serve:ssr": "node dist/app/server/main.js",
    "build:ssr": "ng build -c pwa-production && ng run app:server:pwa-production",
    "prerender": "ng run app:prerender",
    "analyze": "ng build -c pwa-production --stats-json && webpack-bundle-analyzer dist/app/browser/stats.json"
  },
  "browser": {
    "fs": false,
    "path": false,
    "os": false
  },
  "config": {
    "ionic_generate_source_map": "true"
  },
  "private": true,
  "dependencies": {
    "@angular-builders/custom-webpack": "^14.0.0",
    "@angular-material-components/datetime-picker": "^8.0.0",
    "@angular-material-extensions/select-country": "^7.0.1",
    "@angular/animations": "^14.1.0",
    "@angular/cdk": "^14.1.0",
    "@angular/common": "^14.1.0",
    "@angular/core": "^14.1.0",
    "@angular/fire": "^7.4.1",
    "@angular/flex-layout": "^14.0.0-beta.40",
    "@angular/forms": "^14.1.0",
    "@angular/localize": "^14.1.0",
    "@angular/material": "^14.1.0",
    "@angular/platform-browser": "^14.1.0",
    "@angular/platform-browser-dynamic": "^14.1.0",
    "@angular/platform-server": "^14.1.0",
    "@angular/router": "^14.1.0",
    "@angular/service-worker": "^14.1.0",
    "@capacitor-community/admob": "^3.2.0",
    "@capacitor/android": "^3.5.1",
    "@capacitor/app": "^1.1.1",
    "@capacitor/cli": "^3.5.1",
    "@capacitor/core": "^3.5.1",
    "@capacitor/haptics": "^1.1.4",
    "@capacitor/keyboard": "^1.2.2",
    "@capacitor/network": "^1.0.7",
    "@capacitor/splash-screen": "^1.2.2",
    "@capacitor/status-bar": "^1.0.8",
    "@fortawesome/angular-fontawesome": "^0.10.2",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@ionic-native/app-availability": "^5.36.0",
    "@ionic-native/app-minimize": "^5.36.0",
    "@ionic-native/app-rate": "^5.36.0",
    "@ionic-native/clipboard": "^5.36.0",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/facebook": "^5.36.0",
    "@ionic-native/fcm": "^5.36.0",
    "@ionic-native/firebase-analytics": "^5.36.0",
    "@ionic-native/firebase-authentication": "^5.36.0",
    "@ionic-native/firebase-config": "^5.36.0",
    "@ionic-native/in-app-browser": "^5.36.0",
    "@ionic-native/onesignal": "^5.36.0",
    "@ionic-native/status-bar": "^5.36.0",
    "@ionic/angular": "^6.2.1",
    "@ionic/angular-server": "^6.2.1",
    "@ionic/storage": "^2.3.1",
    "@ngrx/effects": "^14.0.2",
    "@ngrx/entity": "^14.0.2",
    "@ngrx/store": "^14.0.2",
    "@ngrx/store-devtools": "^14.0.2",
    "@nguniversal/express-engine": "^14.0.3",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "@robingenz/capacitor-app-update": "^1.3.1",
    "@sentry/angular": "^6.19.7",
    "chart.js": "^3.8.2",
    "chartjs-plugin-annotation": "^2.0.0",
    "chartjs-plugin-datalabels": "^2.0.0",
    "compression": "^1.7.4",
    "cookieconsent": "^3.1.1",
    "cordova-admob-sdk": "^0.24.1",
    "cordova-clipboard": "^1.3.0",
    "cordova-plugin-appavailability": "^0.4.2",
    "cordova-plugin-appminimize": "^1.0.1",
    "cordova-plugin-apprate": "^1.7.2",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-enable-multidex": "^0.2.0",
    "cordova-plugin-facebook-connect": "^3.2.0",
    "cordova-plugin-firebase-analytics": "^6.1.0",
    "cordova-plugin-firebase-authentication": "^5.1.0",
    "cordova-plugin-firebase-config": "^6.1.0",
    "cordova-plugin-firebase-inappmessaging": "^5.0.0",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-plugin-nativestorage": "^2.3.2",
    "cordova-plugin-network-information": "^2.0.2",
    "cordova-promise-polyfill": "0.0.2",
    "cordova-support-android-plugin": "^1.0.1",
    "css-select": "^5.1.0",
    "date-fns": "^2.28.0",
    "distinct-colors": "^3.0.0",
    "es6-promise-plugin": "^4.2.2",
    "express": "^4.18.1",
    "express-static-gzip": "^2.1.6",
    "firebase": "^9.8.1",
    "globalthis": "^1.0.3",
    "goog-webfont-dl": "^1.0.4",
    "install": "^0.13.0",
    "is-unicode-supported": "^1.2.0",
    "jetifier": "^2.0.0",
    "mat-timepicker": "^5.1.5",
    "moment": "^2.29.4",
    "ng2-charts": "^3.0.11",
    "ngx-cookieconsent": "^2.2.3",
    "ngx-ionic-image-viewer": "^0.7.5",
    "onesignal-cordova-plugin": "^3.0.2",
    "redux": "^4.1.2",
    "rxfire": "^6.0.3",
    "rxjs": "^7.5.5",
    "svg-country-flags": "^1.2.10",
    "swiper": "^8.1.4",
    "tslib": "^2.4.0",
    "tui-calendar": "^1.15.2",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/architect": "^0.1401.0",
    "@angular-devkit/build-angular": "^14.1.0",
    "@angular-devkit/core": "^14.1.0",
    "@angular-devkit/schematics": "^14.1.0",
    "@angular/cli": "^14.1.0",
    "@angular/compiler": "^14.1.0",
    "@angular/compiler-cli": "^14.1.0",
    "@angular/language-service": "^14.1.0",
    "@ionic/angular-toolkit": "^6.1.0",
    "@ngrx/schematics": "^13.2.0",
    "@nguniversal/builders": "^13.1.1",
    "@types/express": "^4.17.13",
    "@types/jasmine": "~3.10.3",
    "@types/jasminewd2": "^2.0.10",
    "bufferutil": "^4.0.6",
    "codelyzer": "^6.0.2",
    "jasmine-core": "^4.1.1",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "^6.3.19",
    "karma-chrome-launcher": "^3.1.1",
    "karma-coverage": "^2.2.0",
    "karma-jasmine": "^4.0.1",
    "karma-jasmine-html-reporter": "^1.7.0",
    "ng-mocks": "^13.5.1",
    "protractor": "^7.0.0",
    "puppeteer": "^14.0.0",
    "sonar-scanner": "^3.1.0",
    "ts-node": "~10.4.0",
    "tslint": "~6.1.3",
    "typescript": "~4.7.4",
    "utf-8-validate": "^5.0.9",
    "webpack-bundle-analyzer": "^4.5.0",
    "webpack-cli": "^4.9.2",
    "ws": "^8.4.2",
    "xhr2": "^0.2.1"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-local-notification": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-apprate": {
        "PLAY_CORE_VERSION": "1.+"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-clipboard": {},
      "cordova-plugin-enable-multidex": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-appavailability": {},
      "cordova-plugin-appminimize": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-firebase-inappmessaging": {
        "ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "19.1.+"
      },
      "cordova-plugin-firebase-authentication": {
        "ANDROID_FIREBASE_AUTH_VERSION": "20.0.+"
      },
      "cordova-plugin-firebase-analytics": {},
      "cordova-plugin-firebase-dynamiclinks": {
        "APP_DOMAIN_NAME": "https://links.mypromille.com",
        "APP_DOMAIN_PATH": "/",
        "ANDROID_FIREBASE_DYNAMICLINKS_VERSION": "19.1.+"
      },
      "cordova-plugin-firebase-crashlytics": {
        "ANDROID_FIREBASE_CORE_VERSION": "16.0.0",
        "ANDROID_FIREBASE_ANALYTICS_VERSION": "17.4.3",
        "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "17.1.0"
      },
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-facebook-connect": {
        "APP_ID": "xxx",
        "APP_NAME": "xxx"
      }
    },
    "platforms": [
      "android"
    ]
  }
}

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants