android - react-native 找不到android sdk

标签 android react-native

我已经解决了这里所有类似的问题,但找不到解决方案。我正在我的 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/

相关文章:

javascript - 当应用程序关闭时 React Native 运行任务

xcode - React Native 无限流的Socket SO_ERROR

android - 任务 ':react-native-custom-tabs:transformDexArchiveWithExternalLibsDexMergerForDebugAndroidTest'的执行失败

android - 对于多人在线游戏 : how to initiate data transfer by server and send data to android phone?

android - 在 Android studio 中使用 -Xlint 重新编译

android - 如何以编程方式获取设备的电话号码

android - 在 Android 上使用 Expo 设置排毒

android - Android 平台中的 Activity 和 View 是如何关联的?

android:将常量值分配给 xml 元素

reactjs - 如何使用 react native expo 从手机获取联系人