ionic-team / capacitor

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

[Bug]: Android live reload not opening Android Studio to use correct signing of the app #7433

Closed sergiomilici closed 1 week ago

sergiomilici commented 1 week ago

Capacitor Version

npx cap doctor [warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted. 💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

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

[success] iOS looking great! 👌 [success] Android looking great! 👌

Other API Details

I'm using a complete fresh install of Mac Sonoma 14.4.1

Using Android Studio Iguana | 2023.2.1 Patch 2


> ionic info

Ionic:

   Ionic CLI                     : 7.2.0 (/Users/chicho/.nvm/versions/node/v21.7.3/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 7.8.6
   @angular-devkit/build-angular : 17.3.5
   @angular-devkit/schematics    : 17.3.5
   @angular/cli                  : 17.3.5
   @ionic/angular-toolkit        : 11.0.1

Capacitor:

   Capacitor CLI      : 6.0.0
   @capacitor/android : 6.0.0
   @capacitor/core    : 6.0.0
   @capacitor/ios     : 6.0.0

Cordova:

   Cordova CLI       : not installed
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.1

System:

   NodeJS : v21.7.3 (/Users/chicho/.nvm/versions/node/v21.7.3/bin/node)
   npm    : 10.5.0
   OS     : macOS Unknown
   Xcode  : Xcode 15.3 Build version 15E204a

Platforms Affected

Current Behavior

I want to run Android with live reload option. I was using Capacitor v2 and migrated to v5 and both have the same behaviour. Right now, using capacitor v6, when running ionic cap run android -l --external, this is asking on which device I want to run it. I connect my Google Pixel 6a and the build is run in the phone.

The issue is that capacitor.config.json is not updated (with my local IP as before) and the most important part is that Android studio is not opened. Before capacitor v6, where to run the device was not asked and the IDE was open and I could run the project perfectly on any device I want to.

Without running the app from android studio, I can't use google sign because it's using a different debug.keystore file (I get error 10 when trying o sign using live reload) but it works fine when building from Android Studio.

Expected Behavior

When running ionic cap run android -l --external, these things should happen:

This is the same behaviour it was before cap v6.

Project Reproduction

https://github.com/sergiomilici/capacitor-test-live-reload

Additional Information

The repo is a completely new project without changes, I just added capacitor for android.

sergiomilici commented 1 week ago

Same thing is happening for iOS.

The previous behaviour (cap v5) was great because I could make changes to the native configuration and deploy again very easy on the phone without restarting the web server.

sergiomilici commented 1 week ago

I'm closing this since this was not a bug. The expected behavior can be addressed as before versions by passing --open option. This way, the live reload dev server is started, and the IDE is open (ionic cap run android --open -l --external).

Note: For iOS, when running ionic cap run ios -l --external didn't work for me as I changed the schema. I had the iOS schema in capacitor config file and running from Xcode works and the new schema name is reflected.

I apologize for the inconvenience.