2

Eu estava testando para rodar o meu primeiro projeto no react native, ai rodei o comando “react-native run-android” e apareceu esse erro na licença do android SDK. Meu SO é o linux manjaro. Sou novo em react native, qualquer erro me desculpem.

    [bruno@bruno-pc AwesomeProject]$ react-native run-android
info Starting JS server...
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app
Exception while marshalling /opt/android-sdk/build-tools/28.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platform-tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/build-tools/28.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platform-tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/build-tools/28.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platform-tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/tools/package.xml. Probably the SDK is read-only
File /home/bruno/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 28 in /opt/android-sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /opt/android-sdk

* 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 38s

error Failed to install the app. Please accept all necessary SDK licenses using SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". 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'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /opt/android-sdk

* 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 38s

    at checkExecSyncError (child_process.js:639:11)
    at execFileSync (child_process.js:657:15)
    at runOnAllDevices (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
[bruno@bruno-pc AwesomeProject]$ 
1

4 Respostas 4

5

Melhor solução:

yes | sdkmanager --licenses

0

Verifique as permissões do local de instalações dos arquivos do react native e do SDK do android antes de qualquer tentativa, caso tenha criado como root, você não está com permissões suficientes para criar a chave de licença. Acredito que seja esse o problema pois está na pasta /opt/ do sistema.

Apesar de não programar com react native(apenas android puro e flutter), uma recomendação é que você tente instalar o sdk usando o android studio, pois ele vai gerir estas licenças para você mais facilmente.

0

Comigo funcionou assim no Mac: depois de instalar o java sdk 8:

cd ~/Library/Android/sdk/tools/bin

yes | ./sdkmanager --licenses
-3

Tem que aceitar as licenças sdkmanager --licenses, esse é o comando, aceita as licenças que vai dar certo.

yes | sdkmanager --licenses

Caso não funcione e esteja em um sistema like-Unix(Linux ou mac), verifique o local de instalação do seu sdk, pois pode estar instalado em uma pasta protegida, caso sim use o código a seguir:

sudo su -    
yes | sdkmanager --licenses
1
  • obrigado, o yes não funcionou mas dei o sdkmanager --licenses e fui aceitando uma por uma Commented 2/08/2019 às 16:31

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .