1

I am trying to run Android SDK platform 25 but it keep by default using the Android SDK 23. I am following a tutorial on Lynda.com and when I tryied react-native run-android. I did try this answer by adding new package for the platform 25 and for the platform 23 but I still have the same issue (licensing issue and unable to use the sdk-25). So my question is how can I select the android-sdk version to use.

➜  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

This is my Android sdk path

➜  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

It seems that the SDK is also installed in an other directory

➜  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

Pictures enter image description here enter image description here enter image description here

So even though I am using the AVD manager for the API 25 or 24 on the console (shell) it use the API 25 by default and I always get an Licensing issue for the 23

I am runing Antergos (Arch-linux based)

Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101

1 Answers1

1

I actually went through something like this recently. I was trying to change my build tools and it kept saying the license had not been accepted. When this happened to me I would go back and try to install again but it kept failing with the license error.

Solution

I deleted the SDK folder completely and reinstalled my SDK making sure to accept the license for each of the tools I was installing.

Make sure when you are changing build tools you update the build.gradle file in 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"
        }
    }

You will probably need to sync Gradle again after changing build tools and rebuild the application before the changes will work. If that is the case Android Studio should tell you when you open the application from the Android Studio IDE.

Also please be aware that per the documentation React Native applications should use build tools 23 which you can see here.

wuno
  • 9,547
  • 19
  • 96
  • 180