是的,我知道有数十篇关于此主题的文章,但我尝试过的任何方法都没有用。
我正在从命令行而不是从Android Studio以及Windows上运行Gradle。
我刚刚删除了以前的Android SDK文件夹,下载了最新的Android SDK,并将其安装到C:\ android-sdk
然:
sdkmanager "platform-tools" "build-tools;28.0.3" "platforms;android-26" "platforms;android-28"
然后运行:
sdkmanager --licenses
并接受了所有许可,
回应:接受所有SDK软件包许可证
然后我运行:
C:\Dev>SET ANDROID_HOME=C:/android-sdk&&SET PATH=C:/gradle-4.0/bin;%PATH%&&SET JAVA_HOME=C:/Program Files/Java/jdk1.8.0_31&&cd C:/Android/dev/ProgramName&&gradle clean
并得到这个错误:
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 28.0.3, Android SDK Platform 28].
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.
ANDROID_HOME设置为SDK目录。
我尝试使用不同的Gradle版本进行构建。
删除许可证目录并重新运行“sdkmanager --licenses”
现有的大多数“解决方案”已有数年历史
许多是针对Linux命令行的。
由于这似乎是从Gradle构建中发生的,是否有任何Gradle选项可能会有所帮助?
我确实安装了多个Android SDK,
C:\ Program Files \ android-sdk-windows中的另一个
但是ANDROID_HOME设置为SDK目录
我正在尝试使用。
我以前曾遇到过这个问题,并且能够解决它,但我不记得自己做了什么,而且似乎是在较新的平台上; android-28。
更新:
这很重要的原因之一是Play商店需要
应用程序的目标API到8月为28,这就是为什么
试图做这个构建。
刚刚尝试过,在--build-tools; 28.0.3和platforms; android-28上执行--uninstall,仅保留平台; android-26,
并安装了“build-tools; 28.0.2”,重新输入了sdkmanager --licenses
现在它只得到错误:
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 28.0.2].
谢谢!
最佳答案
您应该接受许可协议(protocol)。