Reputation: 303
I'm unable to accept licenses. When I run flutter doctor -v
, this is displayed:
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/gledyson/bin/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /home/gledyson/bin/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
Then I run flutter doctor --android-licenses
and accept all licenses without an error.
At the end, it says:
All SDK package licenses accepted
But when I run flutter doctor -v
again, the warning persists:
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/gledyson/bin/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /home/gledyson/bin/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
I have installed the Android SDK and the Command Line Tools (latest) as shown in the pictures: android sdk 1 android sdk 2
My OS is Linux Mint 20.2.
Upvotes: 2
Views: 4559
Reputation: 11
It's likely that you don't have the required permissions to accept licenses.
TLDR: run
sdkmanager --licenses
with root privileges
First of all, you should know that flutter doctor --android-licenses
locates and runs sdkmanager --licenses
under the hood (you can verify this using strace), the latter is executed by all users, because exec permissions are granted for them all.
Listing your permissions will likely give something like this:
$ ls -l <path-to-sdkmanager>
-rwxr-xr-x 1 root root 6047 Jul 2 21:17 sdkmanager
As you can see, the file is owned by root
, and only root has write permissions which are required to actually accept licenses. Hence, you can change the owner of the file, or just run it using sudo
Upvotes: 1
Reputation: 1
I'm also a Linux Mint user and I had the same problem, but I found the solution
If you install android studio or sdkmanager in the root folder, then when you want to agree to the license, the license agreement will not change because you have to have root authority first.
try running sdkmanager as root then run sdkmanager --licenses
. if there is a sdkmanager: command not found
problem, first point $PATH to the directory sdkmanager is in and then run it again as root.
note: don't forget to install cmdline-tools and usually sdkmanager is in cmdline-tools folder.
Upvotes: 0
Reputation: 61
open cmd and run this command flutter doctor --android-licenses and accept all. this worked for me.
Upvotes: 3
Reputation: 303
The solution I found was to run the sdkmanager directly with elevated permissions using sudo:
sudo ./sdkmanager --licenses
The sdk file was found under sdk/cmdline-tools/latest/bin
.
This solved my issues.
Upvotes: 4