I created a normal project in android studio and considering to the tutorials I wanted to create an aar
file from that project but I get the following error:
Gradle:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\tec\AndroidStudioProjects\B\B\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':B'.
> Plugin with id 'com.android.library' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
My gradle
file is as follows:
apply plugin: 'com.android.library'
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
You have to update your script:
First of all use the latest gradle plugin.
classpath 'com.android.tools.build:gradle:1.3.0'
Then update your gradle wrapper. Open up this file in your project:
<Project>/gradle/wrapper/gradle-wrapper.properties
distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip
Finally remove the line apply plugin: 'android'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.