当我试图在Android Studio中使用一个库项目时,我收到了这个错误。build.gradle中产生此错误的特定行是
apply plugin: 'com.android.library'我甚至试着把它改成
apply plugin: 'android-library'但它仍然不起作用,相反,它显示:Error:(7, 0) Plugin with id 'android-library' not found.
我甚至试着补充说:
classpath 'com.android.tools.build:gradle:1.2.3.+' 在build.gradle中的依赖项下,仍然什么都没有...
有什么帮助吗?
编辑:整个build.gradle
// This buildscript will assemble the MoPub SDK into an AAR.
repositories {
jcenter()
}
apply plugin: 'android-library'
group = 'com.mopub'
description = '''MoPub SDK'''
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
versionCode 25
versionName "3.8.0"
minSdkVersion 9
targetSdkVersion 22
consumerProguardFiles 'proguard.txt'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main']
renderscript.srcDirs = ['src/main']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt')
}
}
// Note: You will also need a local.properties file to set the location of the SDK in the same
// way that the existing SDK requires, using the sdk.dir property.
// Alternatively, you can set an environment variable called ANDROID_HOME. There is no
// difference between the two methods, you can use the one you prefer.
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3.+'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.mopub.volley:mopub-volley:1.1.0'
}
// Don't run the Robolectric Unit Tests.
check.dependsOn.remove("test")
check.dependsOn.remove("unitTest")
check.dependsOn.remove("testDebug")
check.dependsOn.remove("unitTestDebug")发布于 2015-06-19 15:23:43
你需要这样写:
apply plugin: 'com.android.application'在你的文件中也替换下面的代码:
buildscript {
repositories {
mavenCentral() // or jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3' // 1.3.0-beta2
}
}https://stackoverflow.com/questions/30932278
复制相似问题