I am a young developer looking to create an application using ionic.
trying to start the emulator via capacitor, however, I get the following error:
capacitor.cmd run android --target Pixel_3_API_30
[capacitor] √ Copying web assets from www to android\app\src\main\assets\public in 2.47s
[capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 2.44ms
[capacitor] √ copy android in 2.55s
[capacitor] √ Updating Android plugins in 10.30ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor] √ update android in 109.37ms
[capacitor] × Running Gradle build - failed!
[capacitor] [error] WARNING:: Using flatDirs should be avoided because it doesn’t support any meta-data formats.
[capacitor] Currently detected usages:
[capacitor] - repository flatDir used in: project ‘:app’, project ‘:capacitor-cordova-android-plugins’
[capacitor] WARNING:: Please remove usages of
jcenter() Maven repository from your build scripts and migrate your build to other Maven repositories.
[capacitor] This repository is deprecated and it will be shut down in the future.
[capacitor] See JCenter service update | Android Developers for more information.
[capacitor] Currently detected usages in: root project ‘android’, project ‘:app’, project ‘:capacitor-android’, …
[capacitor] FAILURE: Build failed with an exception.
[capacitor] * What went wrong:
[capacitor] Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
[capacitor] > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project’s local properties file at ‘C:\Users\Stefano\Desktop\Prova-emulatore\emulatore\android\local.properties’.
[capacitor] * Try:
[capacitor] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[capacitor] * Get more help at https://help.gradle.org
[capacitor] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[capacitor] Use ‘–warning-mode all’ to show the individual deprecation warnings.
[capacitor] See Command-Line Interface
[capacitor] BUILD FAILED
[capacitor] in 3s
[ERROR] An error occurred while running subprocess capacitor.
capacitor.cmd run android --target Pixel_3_API_30 exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
I just created a new tabs project and launched the “ionic capacitor run android” command.
what’s the solution?
my ionic version is 6.18.0.
Thanks for your help