我在这里经历了所有类似的问题,但是找不到解决方案。我正在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的本地文件方法。这里我在做什么错了?
答案 0 :(得分:0)
请检查已安装的sdk版本和gradle中的sdk版本
应该相同。
提供相同版本时,它对我有用。