- How to Fix “Failed to install the following Android SDK packages as some licenses have not been accepted” Error in Android Studio?
- What are Android SDK packages?
- How To Solve Failed to install the following Android SDK packages?
- Method 1
- Method 2
- Method 3
- Method 4
- Method 5
- Question: 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.bat app:installDebug -PreactNativeDevServerPort=8081 #25890
- Comments
- elinonga commented Jul 31, 2019
- Coding Questions
- https://stackoverflow.com/questions/tagged/react-native
- Talk to other React Native developers
- https://www.reactiflux.com/
- Accept all licenses #5
- Comments
- rkistner commented Mar 18, 2014
- sebv commented Mar 18, 2014
- austynmahoney commented Mar 31, 2014
- rkistner commented Apr 1, 2014
- gildegoma commented Apr 1, 2014
- rkistner commented Apr 2, 2014
- gildegoma commented Apr 2, 2014
- VS 16.7.0 P3.1 Android SDK License Acceptance Dialog #4880
- Comments
- gmck commented Jun 28, 2020
- brendanzagaeski commented Jun 28, 2020
- Ошибка Android Studio «Установленные средства сборки версии 31.0.0 повреждены»
- 17 ответов
How to Fix “Failed to install the following Android SDK packages as some licenses have not been accepted” Error in Android Studio?
When you download the latest Android SDK tools version using the command line to install SDKs and you just try to build gradle then this error shows up:
You may face this error even after typing y as the answer for the question: Do you accept the license ‘android-sdk-license-c81a61d9’ [y/n]: y. So we need to look at why this error is popping up? Because of this error, we cannot compile our project. So In this article, we will talk about how to solve this error using five different methods. But before directly jumping to solutions first let’s see something about Android SDK.
What are Android SDK packages?
SDK stands for software development kit or devkit for short. The Android SDK consists of an emulator, development tools, sample projects with source code, and the required libraries to build Android applications. The Android SDK Manager, manages various Android SDK versions, tools, and various other useful packages that you can select and download, to keep your development environment up-to-date.
How To Solve Failed to install the following Android SDK packages?
Method 1
You need to accept the licenses before building. According to Android SDK docs, you can use the following command depending on the SDK manager location: Docs on –licenses option seems to be missing though. yes | sdkmanager –licenses
Windows:
Step 1: Navigate to %ANDROID_HOME%/tools/bin .
%ANDROID_HOME% is the path to SDK. By default it is located at : C:\Users\UserName\AppData\Local\android\Sdk . If you have moved SDK to another directory location then you can follow below steps :
- Search for edit the system environment variables.
- Then in the environment variables, you will see ANDROID_HOME.
- Navigate to that path in cmd
Step 2:
After successfully navigating just type below command and you are done.
GNU/Linux Distributions:
macOS:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
Flutter Users:
Just type flutter doctor –android-licenses in the terminal and wait for few seconds. You will see “All SDK package licenses accepted” on your screen.
Method 2
Step 1: In Android Studio go to Tools > SDK Manager.
Step 2: Go to the SDK Tools tab as shown in the below image.
Step 3: Select the Android SDK Command-line Tools (latest) and download by pressing Apply.
Method 3
in Windows OS go to your sdkmanager path then execute
You can find your sdkmanager at: \Android\tools\bin
IF you don’t know where is your SDK located, then follow these steps:
- Open Android Studio
- Navigate to Your Project > Files > Setting > Appearance and Behavior > Android SDK
Method 4
Step 1:Go to your $ANDROID_HOME/tools/bin and fire the cmd and type the below command:
Accept All licenses listed there.
Step 2:
After this just go to the licenses folder in SDK.
Check that it’s having these five files:
- android-sdk-license
- android-googletv-license
- android-sdk-preview-license
- google-gdk-license
- mips-android-sysimage-license
Step 3:
Give a retry and build again, still, Jenkins giving ‘licenses not accepted” then you have to give full permission to your ‘SDK’ directory and all its parent directories. Here is the command:
If you having sdk in /opt/ directory.
Method 5
For Windows users:
Step 1: Go to the location of your sdkmanager.bat file. By default, it is at Android\sdk\tools\bin inside the %LOCALAPPDATA% folder.
Step 2: Open a terminal window there by typing cmd into the title bar. Then go to the above path(Android\sdk\tools\bin as highlighted by the white line in the below image) and type :
Источник
Question: 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.bat app:installDebug -PreactNativeDevServerPort=8081 #25890
Comments
elinonga commented Jul 31, 2019
🚨 The issue tracker is not for questions. 🚨
As it happens, support requests that are created as issues are likely to be closed. We want to make sure you are able to find the help you seek. Please take a look at the following resources.
Coding Questions
https://stackoverflow.com/questions/tagged/react-native
If you have a coding question related to React Native, it might be better suited for Stack Overflow. It’s a great place to browse through frequent questions about using React Native, as well as ask for help with specific questions.
Talk to other React Native developers
https://www.reactiflux.com/
Reactiflux is an active community of React and React Native developers. If you are looking for immediate assistance or have a general question about React Native, the #react-native channel is a good place to start.
If you want to participate in casual discussions about the use of React Native, consider participating in one of the following forums:
If you’d like to discuss topics related to the future of React Native, or would like to propose a new feature or change before sending a pull request, please check out the discussions and proposals repo:
For a full list of community resources, check out React Native’s Community page at https://facebook.github.io/react-native/help.
The text was updated successfully, but these errors were encountered:
Источник
Accept all licenses #5
Comments
rkistner commented Mar 18, 2014
The current echo y | android update sdk . approach only accepts the first license. This has the nice side-effect of preventing the install of the MIPS and Intel emulator images, but is not a very stable solution, and may break in the future. It also prevents the user from installing e.g. the Intel emulator image if he really wants to.
The following alternative has been suggested by @sebv, which accepts all the licenses:
The problem currently is that it causes all emulator images to be installed with e.g. sysimg-17 , which significantly increases the installation time.
To implement this, we therefore first need a way to filter out the emulator images that are installed.
The text was updated successfully, but these errors were encountered:
sebv commented Mar 18, 2014
This is another way to achieve what you want without resorting this kind of hack:
1/ You get the id of the package you want to install:
android list sdk -a | grep ‘ARM EABI v7a System Image, Android API 18, revision 2’ | cut -d ‘-‘ -f1 | tr -d » «
2/ Then use add it to the package in the android-sdk-installer script or install it with
android update sdk —no-ui -a —filter
austynmahoney commented Mar 31, 2014
The current sample Travis-CI Configuration tries to ask the user to accept the license for the new Android Wear SDK.
FIlter
The problem is sysimg-19 now includes the Android Wear SDK, and that license is not accepted with the current code.
rkistner commented Apr 1, 2014
Licenses can now be accepted by passing the licenses in the —accept option. Each license has to be explicitly specified. See https://github.com/embarkmobile/android-sdk-installer/tree/version-2#accepting-licenses for details.
Note that you have to change scripts to use the version-2 branch instead of version-1 , since this now requires the expect package to be installed.
gildegoma commented Apr 1, 2014
FYI: I also introduced similar license strategies in android-sdk chef cookbook v0.1.0 (see gildegoma/chef-android-sdk@cdcad47). This cookbook will be used to build the upcoming Android VM on Travis CI (and it’s not an April Fool!).
Note that I faced some strange installation issue with —filter component1,component2. syntax and (temporarily) work around it with a loop over each item to be installed. Maybe I missed something, as it looks that you have no issues on your ends.
In the next days, I also plan to work on finishing .travis.yml built-in goodies that might allow to trigger extra android update sdk commands. The idea is also here to deal with licenses the easiest way for the end-user. I think that a possible approach could be to integrate/adapt embarkmobile/android-sdk-installer (a version of such helper script could be pre-installed on the Travis VM or auto-downloaded, etc.). That would also prepare the ground for next improvements like Emulator startup, etc.
If you have time and interest to help me to finalize this thing in the best possible way, just know that your advised comments/contributions are always welcome 🙂
rkistner commented Apr 2, 2014
@gildegoma What specifically was the issue you had with that?
At the moment this repo is just designed to do the initial install, which will be rendered semi-obsolete when your Android VM work lands on Travis (on Travis at least). It would be nice to have some scripts to handle the updating properly as well, but that’s a whole new problem unfortunately.
I really wish this kind of functionality would just be included in the core Android SDK, so that we don’t have to rely on workarounds such as this.
The work you’ve done so far for Android support on Travis look good — let me know if there’s anything specific you need help with.
Btw I adapted that expect script of yours to accept the licenses here — hope you don’t mind 🙂
gildegoma commented Apr 2, 2014
Btw I adapted that expect script of yours to accept the licenses here — hope you don’t mind 🙂
Surely not. These are desired «side-effects» of a great community 🙂
It would be nice to have some scripts to handle the updating properly as well, but that’s a whole new problem unfortunately
I think we can re-use some/lots from android-sdk-installer . The idea would be to coordinate it well to maintain the quality on the long run. This additional dev-toolkit (updater, emulator manager, . ) could also be part of android-sdk cookbook features.
I really wish this kind of functionality would just be included in the core Android SDK, so that we don’t have to rely on workarounds such as this.
Is there already an open feature request (on which we could vote) ?
What specifically was the issue you had with that?
With Android SDK 22.6.2, running android update sdk . —filter platform-tools,build-tools-19.0.3,android-19,sysimg-19,android-18,sysimg-18. leads to following setup (platforms are OK, but most system-images are missing):
While running the loop workaround (accepting the intel/x86 license in this example):
installs all components as expected:
I haven’t tested yet with android-sdk-installer (please, let me know if you do this check)
Источник
VS 16.7.0 P3.1 Android SDK License Acceptance Dialog #4880
Comments
gmck commented Jun 28, 2020
Nearly every compiler error triggers this dialog. When I Accept, the build window then displays the following.
The first time it happened, after updating to Preview 3.1, I then just updated the SDK manually. All is ok until the next compiler error when the dialog reappears. If I run it again — same result. Again all is ok until the next compiler error and back it comes. The cmdline-tools folder was created 24/07/2020 and contains a subfolder latest, which contains bin and lib folders both dated 24/07/2020. There are no files in cmdline-tools folder only the folder latest, so the Trying to fallback to «tools».. errors would be correct.
Manually running the Android SDK Manager within VS indicates there are no available updates.
The text was updated successfully, but these errors were encountered:
brendanzagaeski commented Jun 28, 2020
Thanks for submitting this item! This is an unfortunate known issue in Visual Studio 2019 version 16.7 Preview 3, but there are a few workaround options available:
Option A – Set the AndroidCommandLineToolsVersion MSBuild property to latest :
Open the .csproj project file for the Xamarin.Android app project in Visual Studio or another text editor.
Find an existing closing
tag in the file, and add the following additional
element after it:
This option is included in the Visual Studio release notes, but it’s a bit hard to find: https://docs.microsoft.com/visualstudio/releases/2019/release-notes-preview#xamarin
After a fix for this issue becomes available in the next Visual Studio 2019 version 16.7 Preview, be sure to remove the workaround
element to allow the project to use the default recommended value of AndroidCommandLineToolsVersion .
Option B – Temporarily disable the Auto Install Android SDKs feature and ignore the message in the Error List:
Open Tools > Options, open the Xamarin > Android Settings item, and uncheck Auto Install Android SDKs.
After a fix for this issue becomes available in the next Visual Studio 2019 version 16.7 Preview, be sure to re-enable Auto Install Android SDKs.
Option C – Click Cancel on the Android SDK — License Acceptance dialog each time it pops up and ignore the message in the Error List.
Explanation: In this particular case, the «missing Android SDKs» error does not interfere with the build process, so it is OK to ignore the error and dismiss the Android SDK — License Acceptance dialog each time it appears.
Источник
Ошибка Android Studio «Установленные средства сборки версии 31.0.0 повреждены»
Я использую Android Studio 4.2.2. Я создал новый проект и ничего не добавил в стартовый код, и всякий раз, когда я нажимаю кнопку build или run, я получаю эту ошибку:
Я просмотрел предложения других сообщений, но ни одно из этих решений не помогло. Вот что я пробовал:
- Диспетчер SDK> Инструменты SDK> Установите флажок «Показать сведения о пакете», снимите флажок 31.0.0 и нажмите «Применить»> Удалить 31.0.0> Отметьте 31.0.0 и переустановите его.
- В SDK Manager снимите флажок 31.0.0 и попробуйте установить более старую версию (например, я пробовал 30.0.3) и обновите buildToolsVersion в build.gradle до установленной версии.
- Перешел в «Структура проекта»> «Свойства» и убедился, что 31.0.0 выбрано для «Версия инструментов сборки» и «Скомпилированная версия SDK».
- Вручную удалите файлы из папки build-tools; то есть rm -rf /path/to/android/sdk/build-tools/31.0.0 (он не заканчивается на «-rc», как описано в некоторых других сообщениях)
- Перезагрузите Android Studio
- Переустановите Android Studio
Я новичок в Android, просто пытаюсь создать проект hello world, это действительно не должно быть так сложно. Я схожу с ума, кто-нибудь, пожалуйста, помогите. Спасибо за ваше время
17 ответов
Возникла та же проблема, и она была решена с помощью нескольких изменений строк.
Проверьте панель кода проекта и перейдите в Gradle Scripts -> build.gradle file,
- Измените 3 места: compileSdkVersion, buildToolsVersion, targetSdkVersion с 31 на 30
- Вы заметите, что на измененных строках появляется лампочка, щелкните и выберите синхронизацию [с версией 30]. Android Studio автоматически загрузит BuildTool V30 и изменит настройки проекта.
Теперь запустите приложение. Меня устраивает
После изменения версии buid на 30.0.3 кажется, что она работает, пока не появится сообщение об ошибке:
Приложения, ориентированные на Android 12 и выше, должны указывать явное значение для android:exported , если для соответствующего компонента определен фильтр намерений.
Не знаю, как это исправить.
Посмотрите это видео на UTube .. Проблема решена
Источник