I am new to Ionic while build the app in android. Its opening a project in Android Studio but while gradle sync its showing the following error
Could not read script 'F:\IonicProjects\mis-tracking-master-latest\mis-tracking-master\mis-tracking\android\capacitor.settings.gradle' as it does not exist.
Could not read script '…/node_modules/react-native/react. gradle' as it does not exist. This happens while you cloning your project and trying to run the project. The solution is simple just run command npm install in your project folder.
To solve this problem you need to open the project/android/settings. gradle file and have to replace the backslash(\) with the frontslash(/) as windows directory structure do not support the backslash(\).
Open Preferences -> Build, Execution, Deployment -> Gradle . Select Use local gradle distribution and specify Gradle home . On Mac: /usr/local/opt/gradle/libexec in case you installed it via brew . For Windows: specify the path where you installed Gradle.
ionic capacitor sync will do the following: Perform an Ionic build, which compiles web assets. Copy web assets to Capacitor native platform(s) Update Capacitor native platform(s) and dependencies. Install any discovered Capacitor or Cordova plugins.
Try to sync your Ionic project by command:
ionic capacitor sync android
Same thing happen to me. I did a
npm install --save @capacitor/core @capacitor/cli
and this fixes it.
JUST DO
npx cap sync android
If you only use capacitor from (Vuejs, nuxtjs, etc.) without ionic
change the name of my file /android/settings.gradle to capacitor.settings.grandle works for me
just do
npm install jetifier
npx jetify
npx cap sync android
Capacitor troubleshooting https://capacitorjs.com/docs/android/troubleshooting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With