Open PacoRivera13 opened 2 years ago
Did you try using the link from the error? https://github.com/ionic-team/native-run/wiki/Android-Errors
Yes I did, I have my SDK installed at C:\Program Files (x86)\Android\android-sdk then I installed it on a D:Android\sdk
set ANDROID_SDK_ROOT=D:\Android\sdk set ANDROID_HOME=D:\Android\sdk
But any of these are working as expected.
What worked for me: Reboot.
I just set the env variables shortly before. Seems like even after restarting the terminal NodeJs still applies new scripts with the old env variables.
I am facing the same problem. Do you have the solution right now?
I also try "npx cap open android" when gradle, there was an error: Supplied javaHome must be a valid directory.
But I set the JAVA_HOME correctly (edit .bashrc file, adding PATH JAVA_HOME="thepathtotheJavaJRE". But still, the problem persist.
Anyone got the solution? Many thanks
I am facing the same problem. Do you have the solution right now?
I think this is not a bug but a configuration issue. Make sure that Java Home is actually set where you run the command. If you are on windows, make sure to reboot after setting the environment variable. Last one was the reason I had trouble. I think this issue needs to be closed.
My issues was that native-run expect SDK to live in a very specific place, eg on linux it has to be $HOME/Android/sdk
(link), so I had to change my folder structure to accommodate that
My issues was that native-run expect SDK to live in a very specific place, eg on linux it has to be
$HOME/Android/sdk
(link), so I had to change my folder structure to accommodate that
Actually native-run
will resolve Android SDK root folder by parsing env variables in the sequence of ANDROID_HOME, ANDROID_SDK_ROOT, SDK_DIRECTORIES. https://github.com/ionic-team/native-run/blob/c6303f28927031b97c086fb8add861c2376bc352/src/android/utils/sdk/index.ts#L161
if your installed Android SDK in folder other than $HOME/Android/sdk, you should set either ANDROID_HOME or ANDROID_SDK_ROOT environment variables to point to your Android SDK folder.
try run native-run android --sdk-info --verbose
to check if Android SDK root folder get parsed correctly.
Version: 1.6.0
Description: I have defined my sdk location using this command on the cmd set ANDROID_SDK_ROOT=D:\Android\sdk\ set ANDROID_HOME=D:\Android\sdk\ But any of these are working as expected.
Command Output: npx capacitor run android --verbose √ Copying web assets from www to android\app\src\main\assets\public in 1.96s √ Creating capacitor.config.json in android\app\src\main\assets in 1.53ms copy android [info] Found 8 Cordova plugins for android: cordova-plugin-chooser@1.3.2 cordova-plugin-file@6.0.2 cordova-plugin-ionic@5.5.2 cordova-plugin-screen-orientation@3.0.2 cordova-plugin-telerik-imagepicker@2.3.6 cordova-plugin-whitelist@1.3.5 es6-promise-plugin@4.2.2 √ copy android in 2.09s √ Updating Android plugins in 7.77ms [info] Found 5 Capacitor plugins for android: @capacitor/app@1.1.1 @capacitor/camera@1.3.1 @capacitor/haptics@1.1.4 @capacitor/keyboard@1.2.2 @capacitor/status-bar@1.0.8 / update android [info] Found 8 Cordova plugins for android: cordova-plugin-chooser@1.3.2 cordova-plugin-file@6.0.2 cordova-plugin-file-opener2@3.0.5 cordova-plugin-ionic@5.5.2 cordova-plugin-screen-orientation@3.0.2 cordova-plugin-telerik-imagepicker@2.3.6 cordova-plugin-whitelist@1.3.5 es6-promise-plugin@4.2.2 √ update android in 240.14ms [error] native-run failed with error
SDK Info: ERR_SDK_NOT_FOUND: No valid Android SDK root found. More details for this error may be available online: https://github.com/ionic-team/native-run/wiki/Android-Errors