I am getting this error on the latest version of Android Studio and while I have installed both Android SDK Platform API 25 and Android SDK Build-Tools 25.
问题:
回答1:
I had a similar problem. Updating Android Studio to version 2.2.2 (latest at the time of this writing) and Gradle version to 2.2.2 (latest at the time of this writing) in project_name/build.gradle
file fixed this issue.
For reference, this is my config in project_name/app/build.gradle
file:
minSdkVersion = 19
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = "25"
supportLibraryVersion = "25.0.0"
And this is my dependencies
in project_name/build.gradle
file :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
回答2:
As Vishnu said, For me updating Android studio and Gradle didn't fix the problem.
I navigated to Tools -> Android -> SDK Manager and selected BuildTools and checked for the updates related to platform tools. After updating and installing those, fixed my problem.
And for one my friends, the issue got resolved after following the above steps and then navigating to Help->Check for updates-> and installing all the available updates.
Attached Screenshot for the same.
回答3:
I am facing similar issue after upgrading Android Studio to 3.0. A very simple way to fix this is go to
Tools -> Android ->SDK Manager -> SDK Tools
There look for Android SDK platform tools and update it. (Screenshot attached)
Thats it, you don't have to change any other gradle setting.
回答4:
- Open
AndroidMainfest.xml
- Click the red icon => Disable inspection => Error is gone
回答5:
I face same problem but when I swap
buildToolsVersion "25.0.0"
to first line then problem solved. Then the final app grade become:
android {
buildToolsVersion "25.0.0"
compileSdkVersion 25
defaultConfig {
applicationId "com.***"
minSdkVersion 15
targetSdkVersion 25
versionCode 0
versionName "0.0.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
回答6:
Update your android sdk platform-tools to the revision from 24.0.4 to 25.x.x on sdk manager. Then android studio click File->Invalidate Caches/Restart...
The error must be gone now.
回答7:
Try to update
- Android SDK Build-Tools
- Android SDK Platform tools
- Android SDK Tools
- Android Support Repository
- Google Play Services
Google repository
etc to the latest version. Error must be gone.
回答8:
Go to Gradle(app) and replace
buildToolsVersion "25"
to
buildToolsVersion "24.0.4" // Or Latest installed gradle version
also if targetSdkVersion
is 25 then make this 24
回答9:
On command line
./sdkmanager "platform-tools" "platforms;android-26"
./sdkmanager --list
Check if you have update to latest release