简体   繁体   中英

On Windows Linux Subsystem, the Android SDK directory does not exist

I have been running react native for a while on windows 10 but decided to install the ubuntu subsystem to continue my development as I prefer linux for dev work.

After installing ubuntu and trying to build my react native app I get this error.

The SDK directory /mnt/c/Projects/AppName/android/C:\\Users\\UserName\\AppData\\Local\\Android\\Sdk' does not exist.

The path is strange looking as it has my current path concatenated with the actual location of my android sdk on my windows file system (but not the path linux needs as it uses /mnt/c/ instead of C:\\ ). That looks pretty wrong.

Here's some info about my system:

echo $ANDROID_HOME 
/mnt/c/Users/UserName/AppData/Local/Android/sdk/

less android/local.properties
sdk.dir=C\:\\Users\\UserName\\AppData\\Local\\Android\\Sdk

It seems like you should be able to link to the Windows install of the android sdk, if it used my ANDROID_HOME I think it would work. But something tells me I might need to install the sdk separately on ubuntu. I'd like to avoid that for hard disk space reasons.

I'm hoping to be able to keep react native working on windows and in the ubuntu subsystem if possible as I'm not sure if there will be some issue in the future for running react native on ubuntu. It currently works great on windows 10 so... not trying to break that.

Thoughts?

the local.properties file should use a Linux path instead:

# sdk.dir=C\:\\Users\\UserName\\AppData\\Local\\Android\\Sdk
sdk.dir=/mnt/c/Users/UserName/AppData/Local/Android/Sdk

and when switching the OS, just added the # to the other one line.

我编辑~/.profile有这一行:

export $ANDROID_SDK_ROOT=/mnt/c/Users/UserName/AppData/Local/Android/Sdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM