Android studio accept sdk

Как принять лицензии Android Studio SDK?

Итак, перейдя непосредственно к проблеме, я установил последнюю версию Android Studio (3.6.3). Но всякий раз, когда я пытаюсь построить проект и запустить его на эмуляторе, он выдает сообщение об ошибке «Я не принял лицензии SDK» . Это не единственная ошибка, которая появляется. Я приложил скриншот, который вы можете увидеть, чтобы иметь представление о том, что на самом деле является ошибкой (Ошибка Gradle ) .

Я попытался использовать метод cmd, который принимает все лицензии, но он не работает, и cmd выдает ошибку «Системе не удается найти указанный путь» (Ошибка Cmd). Возможно, что я получаю неправильный доступ, я полностью неграмотный. После проверки в папке SDK нет \ tools \ bin (мой путь к SDK). Также я попытался переустановить.

Пожалуйста, помогите мне. Вся моя работа застряла из-за этой ошибки. Любая помощь приветствуется.

2 ответа

В консоли ошибок обычно есть ссылка на отсутствующие инструменты.

Если нет, зайдите в меню Сервис / SDK

  • Затем на вкладку SDK Tools
  • Проверьте инструменты сборки SDK

И тогда вам будет предложено принять лицензии. Будьте осторожны, потому что это радио-кнопка и она немного скрыта.

Если это не удается после выполнения этого наблюдения в консоли, если есть ссылка для установки недостающих инструментов.

Вопрос решен. Как я это решил?

Это было довольно легко, хотя я только что установил еще три (3) SDK-платформы для i-e Android 9.0, Android 8.1 и Android 8.0. инструменты \ sdkmanager \ sdk-platform в IDE Android Studio

Я не знаю, почему это исправило это, но это сделало.

Источник

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 :

Источник

How to Set Java SDK Path in Android Studio?

The Java SDK for Android is a sophisticated suite of tools for managing, monitoring, profiling, and debugging Java code written in Android Studio. But sometimes as software is unpredictable you might be caught in an error that Android Studio stopped compiling projects and says that it can’t locate the 1.7.0_21 folder. Well, this is exactly what is referred to as a missing Java SDK Path.

How to Fix the Java SDK Path?

There are several methods that can help you resolve this issue, the ones which have the highest score in fixing this problem are mentioned below:

Method #1: For Android Studio Version 4.2 and Above

Navigate to File > Project Structure > SDK Location. Upon navigating there you will find that a tab named “JDK Location”, select that and then you can set the JDK path for the current project on which you’re working.

Image I. Setting Project SDK location in 4.2 & +

Method #2: For Android Studio Version Below 4.2

Chances are that you might be rocking an older version of Android Studio, if yes then

Navigate to File > Project Structure > [Platform Settings] > SDKs

You’ll then need to either update your current SDK setup to make use of the new directory or create a new directory and then adjust the settings in your project to make use of the new directory. This will make it applicable to the present project.

Method #3: Adding a new SDK to Your Android Studio

Sometimes only updating your SDKs won’t allow you to compile projects just because the SDK has lived its life and requires an update to itself. In that scenario, you’ll need to recreate the configurations from 0.

  1. Navigate to Project Structure > Platform Settings > SDKs and click the “+” button.
  2. Go to your Android SDK folder and select “Choose” on the pop-up.
  3. A new pop-up window will open, asking which SDK and JDK you’d want to use. Select any Android SDK and the JDK 1.7.

Note: Change your Project SDK to the one you just established under Project Structure > Project Settings > Project. The name of the SDK should now include the new Java version that you installed.

Method #4: For the Command Line Enthusiasts

If you want to be a Geek and the above methods are just too much GUI for you, you might want to handle the SDK path using the terminal. In order to achieve that using the command line, follow the below commands in the Android Studio’s Terminal

Читайте также:  Мини проектор для андроида

and just like that, you’ve achieved the desired result

Note: the ‘oldjre‘ here refers to your old JRE path

Method #5: Using the Embedded SDK

If you are on Android Version 3.2 or older then you’ll be having the option of using the embedded JDK & SDK for your project and that is one of the optimal ways you can fix this issue as Android Studio will handle the management of the services in the Backend!

Navigate to File > Project Structure > JDK Location and Checkmark the box saying “Use embedded JDK (recommended)”.

Image II. Checking the Recommended JDK Location

Method #6: Setting and Viewing SDK using the Studio Project Structure

If all the above-mentioned ways didn’t work out for you, the best you can do is to get the SDK path of another Android Studio Project and then providing that path to your particular project (as in Method #1)

Press Ctrl (Command on Mac) + Alt + Shift + S

Then in the SDK Location tab, you will find your SDK Location, just copy it and paste it in the SDK Location as mentioned in Method #1.

Источник

Install and configure the NDK and CMake

To compile and debug native code for your app, you need the following components:

  • The Android Native Development Kit (NDK): a set of tools that allows you to use C and C++ code with Android.
  • CMake: an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.
  • LLDB: the debugger Android Studio uses to debug native code. By default, LLDB will be installed alongside Android Studio.

This page describes how to install these components automatically, or by using Android Studio or the sdkmanager tool to download and install them manually.

Install NDK and CMake automatically

Android Gradle Plugin 4.2.0+ can automatically install the required NDK and CMake the first time you build your project if their licenses have been accepted in advance. If you’ve already read and agree to the license terms, then you can pre-accept the licenses in scripts with the following command:

Install the NDK and CMake

When you install the NDK, Android Studio selects the latest available NDK. For most projects, installing this default version of the NDK is sufficient. If your project needs one or more specific versions of the NDK, though, you can download and configure specific versions. Doing so helps you ensure reproducible builds across projects that each depend on a specific version of the NDK. Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory.

To install CMake and the default NDK in Android Studio, do the following:

With a project open, click Tools > SDK Manager.

Click the SDK Tools tab.

Select the NDK (Side by side) and CMake checkboxes.

Figure 1: The SDK Tools window showing the NDK (Side by side) option

Читайте также:  Лицензии для ситигид для андроида

Click OK.

A dialog box tells you how much space the NDK package consumes on disk.

Click OK.

When the installation is complete, click Finish.

Your project automatically syncs the build file and performs a build. Resolve any errors that occur.

Configure a specific version of CMake

The SDK Manager includes the 3.6.0 forked version of CMake and version 3.10.2. Projects that don’t set a specific CMake version are built with CMake 3.10.2. To set the CMake version, add the following to your module’s build.gradle file:

Groovy

Kotlin

If you want to use a CMake version that is not included by the SDK Manager, follow these steps:

  1. Download and install CMake from the official CMake website.
  2. Specify the CMake version you want Gradle to use in your module’s build.gradle file.

Either add the path to the CMake installation to your PATH environment variable or include it in your project’s local.properties file, as shown. If Gradle is unable to find the version of CMake you specified in your build.gradle file, you get a build error.

If you don’t already have the Ninja build system installed on your workstation, go to the official Ninja website, and download and install the latest version of Ninja available for your OS. Make sure to also add the path to the Ninja installation to your PATH environment variable.

Install a specific version of the NDK

To install a specific version of the NDK, do the following:

With a project open, click Tools > SDK Manager.

Click the SDK Tools tab.

Select the Show Package Details checkbox.

Select the NDK (Side by side) checkbox and the checkboxes below it that correspond to the NDK versions you want to install. Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory.

Figure 2: The SDK Tools window showing the NDK (Side by side) options

Click OK.

A dialog box tells you how much space the NDK package(s) consumes.

Click OK.

When the installation is complete, click Finish.

Your project automatically syncs the build file and performs a build. Resolve any errors that occur.

Configure each module with the version of the NDK you want it to use. When using Android Studio 3.6 or higher, if you do not specify the version, the Android Gradle plugin chooses a version that it is known to be compatible with.

Configure specific versions of the NDK in your project

You may need to configure the version of the NDK in your project if one of the following is true:

    Your project is inherited and you need to use specific versions of the NDK and the Android Gradle plugin (AGP). For more information, see Configure the NDK for the Android Gradle plugin.

You have multiple versions of the NDK installed and you want to use a specific one. In this case, specify the version using the android.ndkVersion property in the module’s build.gradle file, as shown in the following code sample.

Groovy

Kotlin

Default NDK version per AGP version

Before release, each AGP version is thoroughly tested with the latest stable NDK release at that time. For AGP version 3.6 and above, that NDK version will be used to build your projects if you do NOT specify an NDK version in the build.gradle file. The default NDK version is documented inside the AGP release notes. The current default NDK versions are listed in the following table:

Android Studio/Gradle Plugin Version
7.0 4.2 4.1 4.0 3.6 3.5 3.4
Default NDK version
specified for the version of AGP
21.4.7075529 21.4.7075529 21.1.6352462 21.0.6113669 20.0.5594570 No default specified

Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.

Источник

Оцените статью