1. 在全局路径下修改环境变量
vim ~/.bash_profile
# Setting PATH for Python 3.6 # The original version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}" #如果你不是通过Android Studio安装的sdk,则其路径可能不同,请自行确定清楚。 export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/emulator export GRADLE_HOME=/Applications/Android\ Studio.app/Contents/gradle/gradle-5.1.1 export PATH=${PATH}:${GRADLE_HOME}/bin export ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
2. 在android/ 下增加:local.properties文件
sdk.dir=/Users/liuwei/Library/Android/sdk ndk.dir=/Users/liuwei/Library/Android/sdk/ndk-bundle
3. 将android/app/build.gradle文件中的implement改为compile
4. 另外gradle是负责编译的,参考https://blog.csdn.net/u013553529/article/details/55011602
5. react-native run-android
原文地址:https://www.cnblogs.com/liuw-flexi/p/12342046.html
时间: 2024-10-16 10:24:13