android studio license agreement,Gradle, You have not accepted license agreements (Android SDK)

博主在Windows环境下通过命令行使用Gradle构建项目时遇到Android SDK组件许可协议未接受的问题,尝试了多种解决方案,包括删除旧SDK、安装最新SDK、设置环境变量、接受许可协议等,但仍然报错。问题集中在Android SDK Build-Tools 28.0.3和Android SDK Platform 28上。更新中提到,尝试卸载这些版本并安装28.0.2版本后,错误减少为仅针对Build-Tools 28.0.2。此问题对于即将需要目标API 28的Play Store应用更新至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Yes, I know there are dozens of posts on this subject but nothing I've tried is working.

I'm doing this running Gradle from the command line, not from Android Studio, and on Windows.

I've just deleted my previous Android SDK folder downloaded the latest Android SDK, and installed to C:\android-sdk

Ran:

sdkmanager "platform-tools" "build-tools;28.0.3" "platforms;android-26" "platforms;android-28"

then ran:

sdkmanager --licenses

and accepted every license,

with it's response: All SDK package licenses accepted

Then I run:

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

And get this error:

> 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 is set to the SDK directory.

I've tried building with different Gradle versions.

Deleting the licenses directory and re-running 'sdkmanager --licenses'

Most of the existing "solutions" are several years old

and many are for Linux command lines.

Since this seems to be happening from a Gradle build are there any Gradle options that might help?

I do have more than one Android SDK installed,

another one in C:\Program Files\android-sdk-windows,

but ANDROID_HOME is set to the SDK directory

I'm trying to use.

I've had this issue before and was able to resolve it, but I can't remember what I did, and it seems to be with the newer platforms;android-28.

UPDATE:

One reason this is important is that the Play Store will require

apps to have a target API of 28 by August, which is why I was

trying to do this build.

Just tried this, did --uninstall on "build-tools;28.0.3" and "platforms;android-28", leaving only platforms;android-26,

and installed "build-tools;28.0.2", re-did sdkmanager --licenses

and now it only gets the error:

> You have not accepted the license agreements of the following SDK components:

[Android SDK Build-Tools 28.0.2].

Thanks!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值