ionic-team / capacitor

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

bug: Library projects cannot set applicationId - Android Studio #2536

Closed MarioC3 closed 4 years ago

MarioC3 commented 4 years ago

Bug Report

Capacitor Version

npx cap doctor output: 💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 1.5.1

@capacitor/core: 1.5.1

@capacitor/android: 1.5.1

@capacitor/ios: 1.5.1

Installed Dependencies:

@capacitor/cli 1.5.1

@capacitor/core 1.5.1

@capacitor/android 1.5.1

@capacitor/ios 1.5.1

[success] Android looking great! 👌 Found 20 Capacitor plugins for ios: cordova-plugin-app-version (0.1.9) cordova-plugin-background-mode (0.7.2) cordova-plugin-device (2.0.2) cordova-plugin-dialogs (2.0.2) cordova-plugin-extended-device-information (2.2.0) cordova-plugin-file (6.0.1) cordova-plugin-globalization (1.11.0) cordova-plugin-inappbrowser (3.1.0) cordova-plugin-ionic-keyboard (2.1.3) cordova-plugin-ionic-webview (4.1.3) cordova-plugin-media (5.0.2) cordova-plugin-media-capture (3.0.2) cordova-plugin-nativeaudio (3.0.9) cordova-plugin-network-information (2.0.1) cordova-plugin-speechrecognition (1.2.0) cordova-plugin-splashscreen (5.0.2) cordova-sqlite-storage (3.2.0) instabug-cordova (8.6.5) cordova-plugin-statusbar (2.4.2) cordova-plugin-whitelist (1.3.3) [success] iOS looking great! 👌

Affected Platform(s)

Current Behavior

Whenever I run npx cap open android, android studio opens and starts building, but the build always fails with this error:

ERROR: Library projects cannot set applicationId. applicationId is set to 'capacitor.android.plugins' in default config.
Affected Modules: embark-android-capacitor-cordova-android-plugins

Expected Behavior

Android studio builds the project successfully.

Sample Code or Sample Application Repo

Reproduction Steps

Other Technical Details

npm --version output: 6.13.7

node --version output: v10.16.3

pod --version output (iOS issues only):

Other Information

I found this issue -> https://github.com/ionic-team/capacitor/issues/531 It's similar than mine, but I'm not using any of those plugins, mentioned in the issue

NikolaPeevski commented 4 years ago

@MarioC3 Do you happen to have applicationId being set in your build.gradle?

MarioC3 commented 4 years ago

@NikolaPeevski It is set on the app>build.graddle. But not on the capacitor-cordova-android-plugins>build.graddle where the error is saying it's being affected.

NikolaPeevski commented 4 years ago

@MarioC3 can you provide a repo I can checkout locally ?

MarioC3 commented 4 years ago

Actually, I think I fix it. You point me in the correct direction. Also, this helped me -> https://stackoverflow.com/questions/27374933/android-studio-1-0-and-error-library-projects-cannot-set-applicationid

NikolaPeevski commented 4 years ago

@MarioC3 hah that's cool, I was also reading that :)

MarioC3 commented 4 years ago

Actually never mind. I tried running the app and had the same problem. :(

NikolaPeevski commented 4 years ago

@MarioC3 Gimme a repo I can checkout

MarioC3 commented 4 years ago

@NikolaPeevski Unfortunately I can' t. The problem in my job's private repo.

NikolaPeevski commented 4 years ago

@MarioC3 can you post the output of ionic info ?

Edit: Does it build from the CLI ?

MarioC3 commented 4 years ago

This is the output for ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0
   Ionic Framework               : @ionic/angular 4.2.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1

Capacitor:

   capacitor (Capacitor CLI) : 1.5.1
   @capacitor/core           : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (/Users/marioacarlos/Library/Android/sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.1
   NodeJS            : v10.16.3 (/Users/marioacarlos/.nvm/versions/node/v10.16.3/bin/node)
   npm               : 6.9.0
   OS                : macOS
   Xcode             : Xcode 11.3.1 Build version 11C504

Do you mean build it with cordova?

jcesarmobile commented 4 years ago

one of your plugins is trying to set the applicationId from a gradle script, you'll have to figure out which one

jcesarmobile commented 4 years ago

I'm closing since you'll have to find the plugin and fix it yourself, plugins should not be setting the applicationId anyway.

MarioC3 commented 4 years ago

Thanks for the response.

vokamut commented 1 year ago

My fix: https://github.com/ionic-team/capacitor/issues/2511#issuecomment-1290020640

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.