我正在尝试运行 Android SDK平台25 ,但默认情况下使用Android SDK 23.我正在关注Lynda.com上的教程,当我尝试react-native run-android
时。我通过为平台25和平台23添加新包来尝试此answer但我仍然遇到相同的问题(许可问题并且无法使用sdk-25)。所以我的问题是如何选择要使用的android-sdk版本。
➜ Bakesale react-native run-android
Scanning folders for symlinks in /home/guinslym/Documents/Github/Bakesale/node_modules (24ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
File /home/guinslym/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 23.0.1 in /opt/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 23.0.1 not accepted.
Checking the license for package Android SDK Platform 23 in /opt/android-sdk/licenses
Warning: License for package Android SDK Platform 23 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 23, Android SDK Build-Tools 23.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
这是我的Android sdk
路径
➜ Bakesale echo $ANDROID_HOME
/opt/android-sdk
➜ Bakesale cd !$
➜ Bakesale cd $ANDROID_HOME
➜ android-sdk tree -L 3
.
└── build-tools
├── 23.0.3
│ ├── aapt
│ ├── aarch64-linux-android-ld
│ ├── aidl
│ ├── arm-linux-androideabi-ld
│ ├── bcc_compat
│ ├── dexdump
│ ├── dx
│ ├── i686-linux-android-ld
│ ├── jack.jar
│ ├── jill.jar
│ ├── lib
│ ├── llvm-rs-cc
│ ├── mainDexClasses
│ ├── mainDexClasses.rules
│ ├── mipsel-linux-android-ld
│ ├── NOTICE.txt
│ ├── renderscript
│ ├── runtime.properties
│ ├── source.properties
│ ├── split-select
│ └── zipalign
└── 24.0.3
├── aapt
├── aapt2
├── aarch64-linux-android-ld
├── aidl
├── apksigner
├── arm-linux-androideabi-ld
├── bcc_compat
├── dexdump
├── dx
├── i686-linux-android-ld
├── jack-coverage-plugin.jar
├── jack-jacoco-reporter.jar
├── jack.jar
├── jill.jar
├── lib
├── lib64
├── llvm-rs-cc
├── mainDexClasses
├── mainDexClasses.rules
├── mipsel-linux-android-ld
├── NOTICE.txt
├── renderscript
├── runtime.properties
├── source.properties
├── split-select
├── x86_64-linux-android-ld
└── zipalign
➜ 24.0.3 sdkmanager
zsh: command not found: sdkmanager
SDK似乎也安装在其他目录中
➜ 24.0.3 cd
➜ ~ cd /home/guinslym/Android/Sdk
➜ Sdk ls
add-ons emulator licenses platforms skins system-images
build-tools extras patcher platform-tools sources tools
➜ Sdk cd build-tools
➜ build-tools ls
23.0.1 26.0.1 26.0.2 27.0.2
所以,即使我在控制台(shell)上使用AVD管理器用于API 25或24,它默认使用API 25而且我总是得到23的许可问题
我正在运行Antergos(基于Arch-linux)
答案 0 :(得分:1)
我最近经历过这样的事情。我试图改变我的构建工具,它一直说许可证没有被接受。当我遇到这种情况时,我会回去尝试重新安装,但它仍然因许可证错误而失败。
<强>解决方案强>
我完全删除了SDK文件夹并重新安装了我的SDK,确保接受我正在安装的每个工具的许可证。
确保在更改构建工具时更新build.gradle
android/app/build.gradle
文件
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId packageId
minSdkVersion 19
targetSdkVersion 25
versionCode buildVersionCode()
versionName version
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
更改构建工具后,您可能需要再次同步Gradle
,并在更改生效之前重建应用程序。如果是这种情况,Android Studio会在您从Android Studio IDE打开应用程序时告诉您。
另请注意,根据文档,React Native应用程序应使用构建工具23,您可以看到here。