我在网上看过一遍,还没有在Mac上找到解决此问题的方法。
我使用的是本机响应,每当我在终端上运行services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddJsonOptions(option => option.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);
时,都会出现以下错误
react-native run-android
问题是,在我的BUILD FAILED in 6s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/aaronmccloskey/git/airbnb/android/local.properties'.
* 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 6s
中存在这个环境变量.bash_profile
ANDROID_SDK_ROOT
当我运行export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export ANDROID_HOME=/Users/{username}/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
时,它返回空白吗?
但是,当我打开echo $ANDROID_HOME
文件并运行.bash_profile
然后运行source ~/.bash_profile
时,它将返回正确的目录,并且运行echo $ANDROID_HOME
也可以。
但是为什么每次启动系统时都必须继续运行react-native run-android
。有点令人沮丧。
任何帮助将不胜感激。