Capacitor-android projectDir default path change in latest version

Is there any reason to move capacitor plugin folder from android/cpacitor to …/node_modules/@capacitor/android/capacitor ?

We don’t commit node_modules to git repository : So my custom change of capacitor plugins sources are
removed after redo the command “npm i”.

I can resolve this issue by modifying capacitor.settings.gradle but
Please inform me the reason If ionic team has a special intension.

Best regards,
from Peter Khang.

You should not be modifying node_modules at all in general. If you want to modify plugins like that, you should be making your own plugins and maintaining them.

1 Like

I didn’t even know my modifying node_modules : I deployed android native app using “npx cap add ; npx cap sync” and then I have built my android app in Android-Studio. And then in another computer I did “git clone” and rebuild the android Project But I have got errors all though I have resolved all before. In some time exploring, I have found capacitor-native plugin source is located under node_modules… We don’t push node_modules to repository. It is even. And sometime capacitor-native plugin is not perfect : so we must resolve it … : This is not a request and just notification for real user issue …

It is more helpful that ionic (npx cap sync) copy node_modules/@capacitor/android/capacitor to android/ folder insetead of change capcitor.settings.gradle because native plugin can be modified according to new native platform version when native api is changed before new plugin is updated.

But this issue is trivial because I have already know the plugin source location :smile:

Recent capacitor android native plugin is built without no error all though it don’t support androidX and kotlin. So ionic team probably set capacitor plugin sources under node_modules with confidence :blush:

I will use ionic teams native plugin without migration to androidX from now on.
But It is so hard work to follow up the native framework version up as I think:
Thanks God for both ionic and android team is in google. :star_struck:

Many client will love this news : Ionic app can be built as android app without any modifications.

All though ionic capacitor native plugin is so perfect, I think It is more logical that capacitor/cordova native plugin sources located(or copied) under android folder :blush: This is my own opinion…

Angular/Ionic Framework is so wonderful weapon for front developer, but native plugin issue was so hard If one time build fails.

If ionic app can be deployed to android and ios app without native plugin modification and errors, Many clients will select ionic framework more than now
as I think.

May God bless your team.

In this week, I am digging with ionic android platform: I am sorry but I should copy node_modoules/cordova-xxx my custom androidReal folder.
It’s so difficult to migrate to androidX and resolve issues but It is more efficient because I will make many android apps. :sob:

You should not be modifying ANY file in node_module.

If you’re just trying to support AndroidX, you can use the beta release of Capacitor 2.0

1 Like

As mhartington said, use Capacitor 2.0 beta 0 (npm install @capacitor/android@next).

If plugins you use are not updated to Android X, then use jetifier to patch them, or send a pull request to the plugin so they update

npm install jetifier
npx jetify
1 Like

I see I will try all though I have almost resolved old version.

Thanks for Ionic team’s efforts.

Maybe common.io version mis-match exist as I think:

/android/capacitor-cordova-android-plugins/src/main/java/com/ionicframework/common/IonicCordovaCommon.java:213: error: cannot find symbol
FileUtils.copyDirectory(srcFile, new File(target));
^
symbol: method copyDirectory(File,File)
location: class FileUtils

Android Project folder structure is somethig strange : it has same name folder under plugin folder …

This has two folders and my ionic project package.json

  • android(generated) and androidPeter(I am migrating…) :

Please check my version : Mine has runtime bug yet and I am doing it.

https://github.com/peterkhang/capcitorBetaTest.git

@capacitor/android”: “^2.0.0-beta.0”
Recent native android deployment build and run fine .

Only one error occurs : commons.io error : FileUtil.copyDirectoy() not found.

I have auto androidx build success :star_struck:

I have found that cordova sources are copied to andorid/capacitor-cordova-android-pugin/src all though cordova-plugin-xxx project depenecies are located under node_modules.

Android native app run is OK but TTS & STT don’t work all though ios TTS & STT works fine.

If possible, “npx cap sync only a plugin module” will be needed because “npx cap sync” copy all (plugins , assets and project settings) and so break my resolving sources and gradle.build configuration.

http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Native: tried calling Text To Speech.stop, but the Text To Speech plugin is not installed.
2020-03-22 21:58:50.274 29448-29853/io.bory.speechmate V/Capacitor/Plugin: To native (Cordova plugin): callbackId: SpeechRecognition1716697393, service: SpeechRecognition, action: startListening, actionArgs: [“ko-KR”,1,“말씀해 주세요”,false,true]
2020-03-22 21:58:50.275 29448-29853/io.bory.speechmate D/SpeechRecognition: execute() action startListening
2020-03-22 21:58:50.275 29448-29448/io.bory.speechmate W/Capacitor/Console: File: http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Install the Text To Speech plugin: ‘ionic cordova plugin add cordova-plugin-tts’
2020-03-22 21:58:50.306 29448-29448/io.bory.speechmate D/InputMethodManager: HSIFW - flag : 0 Pid : 29448
2020-03-22 21:58:50.310 2928-3683/? V/VibratorService: vibrate - package: io.bory.speechmate, token: android.os.BinderProxy@7a5a8ec, effect: OneShot{mTiming=1000, mAmplitude=-1, mMagnitude=-1, mMagnitudeType=TYPE_EXTRA}, mag: 9999, TYPE_EXTRA
2020-03-22 21:58:50.314 29448-29853/io.bory.speechmate V/Capacitor/Plugin: To native (Cordova plugin): callbackId: SpeechRecognition1716697394, service: SpeechRecognition, action: stopListening, actionArgs:
2020-03-22 21:58:50.314 29448-29448/io.bory.speechmate V/Vibrator: Called cancel() API - PUID: 10039, PackageName: io.bory.speechmate, token: android.os.Binder@2b6cd5
2020-03-22 21:58:50.314 29448-29853/io.bory.speechmate D/SpeechRecognition: execute() action stopListening
2020-03-22 21:58:50.317 29448-29448/io.bory.speechmate W/Capacitor/Console: File: http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Native: tried calling Text To Speech.stop, but the Text To Speech plugin is not installed.
2020-03-22 21:58:50.319 29448-29448/io.bory.speechmate W/Capacitor/Console: File: http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Install the Text To Speech plugin: ‘ionic cordova plugin add cordova-plugin-tts’
2020-03-22 21:58:50.320 29448-29853/io.bory.speechmate V/Capacitor/Plugin: To native (Cordova plugin): callbackId: SpeechRecognition1716697395, service: SpeechRecognition, action: stopListening, actionArgs:
2020-03-22 21:58:50.321 29448-29448/io.bory.speechmate W/Capacitor/Console: File: http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Native: tried calling Text To Speech.stop, but the Text To Speech plugin is not installed.
2020-03-22 21:58:50.321 29448-29853/io.bory.speechmate D/SpeechRecognition: execute() action stopListening
2020-03-22 21:58:50.322 29448-29448/io.bory.speechmate W/Capacitor/Console: File: http://localhost/main-es2015.a3c66ac0a5ca64f09ad0.js - Line 1 - Msg: Install the Text To Speech plugin: ‘ionic cordova plugin add cordova-plugin-tts’