我已经解决了这里所有类似的问题,但找不到解决方案。我正在我的 xubuntu 18.04 上测试 react-native,我卡在了在手机上启动应用程序的最后一步。我已经安装了 android-sdk,它位于 /usr/lib/android-sdk
,
当我执行 adb devices
我在 .bashrc 文件中添加了以下内容并完成了 $ source ~/.bashrc
并重新启动了终端并尝试再次运行该应用程序
export ANDROID_HOME=/usr/lib/android-sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/24.0.0:$PATH
我不断得到:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and
have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
我还尝试了使用 local.properties 文件并添加 sdk 的本地文件方法。我在这里做错了什么?
最佳答案
请检查安装的sdk版本和gradle中sdk的版本
应该是一样的
当提供相同的版本时它对我有用。
关于android - react-native 找不到android sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53532459/