Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License for package Android SDK Platform 27 not accepted. #26832

Open
aiqinxuancai opened this Issue Jan 21, 2019 · 24 comments

Comments

Projects
None yet
10 participants
@aiqinxuancai
Copy link

aiqinxuancai commented Jan 21, 2019

i have tried the following:
flutter doctor --android-licenses
and
PS C:\Users\aiqin\AppData\Local\Android\Sdk\tools\bin> ./sdkmanager --licenses

Steps to Reproduce/Logs

PS C:\Users\aiqin> cd D:\git\myflutter
PS D:\git\myflutter> flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling
software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       1.1s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\git\myflutter\android\gradlew.bat" exited abnormally:

> Configure project :app
Checking the license for package Android SDK Platform 27 in C:\Users\aiqin\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 27 not accepted.


FAILURE: Build failed with an exception.

* Where:
Build file 'D:\git\myflutter\android\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to install the following Android SDK packages as some licences have not been accepted.
        platforms;android-27 Android SDK Platform 27
     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: C:\Users\aiqin\AppData\Local\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 5s
  Command: D:\git\myflutter\android\gradlew.bat app:properties


Please review your Gradle project setup in the android/ folder.`
PS C:\Users\aiqin\AppData\Local\Android\Sdk\tools\bin> flutter doctor -v
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17763.253], locale zh-CN)
    • Flutter version 1.0.0 at D:\flutter
    • Framework revision 5391447fae (7 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\aiqin\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] VS Code (version 1.30.2)
    • VS Code at C:\Users\aiqin\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.21.1

[√] VS Code, 64-bit edition (version 1.30.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.21.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)

• No issues found!`
PS C:\Users\aiqin\AppData\Local\Android\Sdk\tools\bin> flutter --verbose doctor -v
[  +34 ms] executing: [D:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +112 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +4 ms] origin/stable
[   +2 ms] executing: [D:\flutter\] git rev-parse --abbrev-ref HEAD
[  +61 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] stable
[   +1 ms] executing: [D:\flutter\] git ls-remote --get-url origin
[  +62 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[   +1 ms] executing: [D:\flutter\] git log -n 1 --pretty=format:%H
[  +63 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +1 ms] 5391447fae6209bb21a89e6a5a6583cac1af9b4b
[   +1 ms] executing: [D:\flutter\] git log -n 1 --pretty=format:%ar
[  +61 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[   +1 ms] 7 weeks ago
[   +1 ms] executing: [D:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[  +68 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[   +3 ms] v1.0.0-0-g5391447fa
[ +743 ms] java -version
[  +28 ms] [√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17763.253], locale zh-CN)
[   +5 ms]     • Flutter version 1.0.0 at D:\flutter
[   +1 ms]     • Framework revision 5391447fae (7 weeks ago), 2018-11-29 19:41:26 -0800
[   +1 ms]     • Engine revision 7375a0f414
[   +3 ms]     • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
-[   +4 ms] executing: C:\Users\aiqin\AppData\Local\Android\sdk\platform-tools\adb devices -l
[  +52 ms] Exit code 0 from: C:\Users\aiqin\AppData\Local\Android\sdk\platform-tools\adb devices -l
[   +1 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86
           transport_id:6
[  +29 ms] C:\Users\aiqin\AppData\Local\Android\sdk\platform-tools\adb -s emulator-5554 shell getprop
|[ +163 ms] ro.hardware = ranchu
[  +45 ms] executing: C:\Users\aiqin\AppData\Local\Android\sdk\tools\bin\sdkmanager --licenses
[+4109 ms] [√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[   +1 ms]     • Android SDK at C:\Users\aiqin\AppData\Local\Android\sdk
[   +1 ms]     • Android NDK location not configured (optional; useful for native profiling support)
[   +1 ms]     • Platform android-28, build-tools 28.0.3
[   +3 ms]     • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
[   +3 ms]     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[   +1 ms]     • All Android licenses accepted.
[   +2 ms] [√] Android Studio (version 3.2)
[   +3 ms]     • Android Studio at C:\Program Files\Android\Android Studio
[   +1 ms]     X Flutter plugin not installed; this adds Flutter specific functionality.
[   +1 ms]     X Dart plugin not installed; this adds Dart specific functionality.
[   +1 ms]     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[   +2 ms] [√] VS Code (version 1.30.2)
[   +2 ms]     • VS Code at C:\Users\aiqin\AppData\Local\Programs\Microsoft VS Code
[   +1 ms]     • Flutter extension version 2.21.1
[   +1 ms] [√] VS Code, 64-bit edition (version 1.30.2)
[        ]     • VS Code at C:\Program Files\Microsoft VS Code
[   +1 ms]     • Flutter extension version 2.21.1
[   +1 ms] [√] Connected device (1 available)
[   +1 ms]     • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)
[   +2 ms] • No issues found!
[  +12 ms] "flutter doctor" took 5,104ms.
@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 21, 2019

A problem occurred configuring project ':app'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
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

It seems failed because of the licences issue.
@aiqinxuancai
After you flutter doctor --android-licenses and accept all licenses,
do this issue remain?

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 21, 2019

A problem occurred configuring project ':app'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
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

It seems failed because of the licences issue.
@aiqinxuancai
After you flutter doctor --android-licenses and accept all licenses,
do this issue remain?

yea.

@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 21, 2019

[ +1 ms] • All Android licenses accepted.

vs

A problem occurred configuring project ':app'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
To build this project, accept the SDK license agreements and install the missing components using the Android

Wired.

The android license logic in flutter doctor is implemented using sdkmanager --licenses,it seems ok.
Try clean the flutter project and open the android project with android studio.
You can regard it as a pure android project and check why it happens.

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 21, 2019

image
↑ open flutter/android project and make.

[ +1 ms] • All Android licenses accepted.

vs

A problem occurred configuring project ':app'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
To build this project, accept the SDK license agreements and install the missing components using the Android

Wired.

The android license logic in flutter doctor is implemented using sdkmanager --licenses,it seems ok.
Try clean the flutter project and open the android project with android studio.
You can regard it as a pure android project and check why it happens.

image
↑ open flutter/android project and make.

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 21, 2019

problem is solved.
because android studio installs only Android 9.0 SDK by default..
after installing Android sdk8.0, 8.1, the problem is solved.
image

@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 21, 2019

@aiqinxuancai
Are you saying that if I only install Android 9.0, I may reproduce this issue?

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 21, 2019

@kangwang1988
using the new win10 system, installing Flutter as per the documentation should reproduce the problem.
i am very sure that this problem has been resolved after installing Android SDK 8.1 and 8.0.

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 21, 2019

@kangwang1988
my steps:
1.Flutter download and setting Path.
2.run flutter doctor.
3.Setup Android Studio.
4.run flutter doctor --android-licenses .
5.Open AVD Manager, Create Virtual Device -> Next -> Select system image -> download API level 27 -> Next -> Finish.
6.run flutter run -> problem appear.
7.Repeated run flutter doctor --android-licenses and ./sdkmanager --licenses, Unable to solve the problem.
8.Open Android Studio Settings, find Android SDK, Only the Android SDK 9.0 is checked here.
9.checked Android SDK 8.0 8.1 and download , Apply and OK.
problem is solved.

@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 21, 2019

@aiqinxuancai
Thanks for your efforts to reproduce it.
Will try to reproduce it.

@tzattera

This comment has been minimized.

Copy link

tzattera commented Jan 21, 2019

Thanks a lot @aiqinxuancai . I had the same problem today and only your solution works for me.

@aldarisbm

This comment has been minimized.

Copy link

aldarisbm commented Jan 21, 2019

Had the same problem today and same solution. (when only sdk 9 available it wont start)

I think it might be looking for the SDK platform 27 license even when it isnt installd

@zoechi zoechi added this to the Goals milestone Jan 21, 2019

@oscyp

This comment has been minimized.

Copy link

oscyp commented Jan 21, 2019

Yeah, same issue.

Didn't have SDK 27, only 28 and flutter searching for 27 license which of course cannot be found.

* Error running Gradle:
ProcessException: Process "C:\Sources\xxx\android\gradlew.bat" exited abnormally:

Configure project :app
Checking the license for package Android SDK Platform 27 in c:\Users\user\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 27 not accepted.


FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Sources\xxx\android\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to install the following Android SDK packages as some licences have not been accepted.
        platforms;android-27 Android SDK Platform 27
     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: c:\Users\user\AppData\Local\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 2s
  Command: C:\Sources\xxx\android\gradlew.bat app:properties


Please review your Gradle project setup in the android/ folder.

@jonahwilliams

This comment has been minimized.

Copy link
Contributor

jonahwilliams commented Jan 22, 2019

cc @dnfield , is this related to (or fixed by) your recent sdk version changes?

@dnfield

This comment has been minimized.

Copy link
Member

dnfield commented Jan 22, 2019

I'm seeing this error on CI for plugins and packages. Are you using any plugins?

@dnfield

This comment has been minimized.

Copy link
Member

dnfield commented Jan 22, 2019

My theory right now is that something in the gradle ecosystem changed on Friday and caused a lot of breakage for us. If you're using anything that has dependencies on Android Support (like plugins, in particular Firebase seems like an issue at the moment), it's broken.

I'm working on reproducing this locally so I cna more fully debug. One thing I'd suggest is that you install SDK 27 and the 27.0.3 build tools so you can try to get a more meaningful error message - when I did that in our CI it at least started telling me what dependencies were actually failing.

@dnfield

This comment has been minimized.

Copy link
Member

dnfield commented Jan 22, 2019

FYI, what should be an easy way to get the version 27 bits anyone is looking for is to run $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-27" "build-tools;27.0.3" (and accept the licenses - note that this has to be done with Java8, higher versions will fail unless you set some strange environment variables). However I suspect at least some people will see different errors after that.

@gavin103

This comment has been minimized.

Copy link

gavin103 commented Jan 23, 2019

problem is solved.
because android studio installs only Android 9.0 SDK by default..
after installing Android sdk8.0, 8.1, the problem is solved.
image

encounter the same "gradle" issue, and resolved with this way. Tks

@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 23, 2019

image

Fail to reproduce this issue.
My flutter doctor -v:

KyleWongdeMacBook-Pro:license_demo kylewong$ /Users/kylewong/Codes/Flutter/alibaba-flutter/flutter/bin/flutter doctor -v
[✓] Flutter (Channel master, v1.1.10-pre.149, on Mac OS X 10.14.3 18D32a, locale en-CN)
    • Flutter version 1.1.10-pre.149 at /Users/kylewong/Codes/Flutter/alibaba-flutter/flutter
    • Framework revision 7619c68655 (2 hours ago), 2019-01-22 16:39:09 -0800
    • Engine revision 869d9f5285
    • Dart version 2.1.1 (build 2.1.1-dev.2.0 2e5453ddb4)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/kylewong/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    ! CocoaPods out of date (1.5.0 is recommended).
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup

[!] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.30.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.21.1

[✓] Connected device (2 available)
    • MHA AL00 • GWY7N16B02004245 • android-arm64 • Android 8.0.0 (API 26)
@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 23, 2019

@kangwang1988

  • Uncheck the SDK and then uncheck it. It doesn't seem to cause problems again.
  • I think it is possible to reproduce only in windows.
@kangwang1988

This comment has been minimized.

Copy link
Member

kangwang1988 commented Jan 23, 2019

Maybe I've found out why:
flutter doctor --android-licenses only check the installed api, 28 in my case.
If it's a newly create project by flutter, as the compileSdkVersion/buildToolsVersion(if specified) are all set to 28, it's ok.
However, if you run a flutter project where there is some other specification like buildToolsVersion "26.0.2",

* What went wrong:
A problem occurred configuring project ':xxx'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Platform 26, Android SDK Build-Tools 26.0.2].
  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

The problem appears.
It seems to be project related, the doctor command can't know much about which kind of Build-Tools you specified in your project.
@aiqinxuancai
Check if you specified 27 related setting in your project.

@dnfield

This comment has been minimized.

Copy link
Member

dnfield commented Jan 23, 2019

See https://issuetracker.google.com/issues/123054726

I suspect you're running into that issue.

Have you tried the command I suggested @aiqinxuancai ?

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 23, 2019

@kangwang1988 myproject was created by the command "flutter create xxxx", I have not made any changes.

@aiqinxuancai

This comment has been minimized.

Copy link
Author

aiqinxuancai commented Jan 23, 2019

@dnfield
I am not sure, but I have solved it now.
#26832 (comment)

@jjangga0214

This comment has been minimized.

Copy link

jjangga0214 commented Jan 23, 2019

On ubuntu 18.04, the same issue occured.
I've just started flutter today and followed "get started" tutorial on the official website.
After I just checked the version I targeted(in my case Nougat), the issue was resolved.
the method(aiqinxuancai 's comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.