gpt4 book ai didi

android - Gradle:找不到 ID 为 'android-library' 的插件

转载 作者:太空宇宙 更新时间:2023-11-03 10:20:25 26 4
gpt4 key购买 nike

我正在尝试使用 Gradle 自动化我的项目。

我有几个应用程序和一个库项目。仔细阅读 official doc 后,这是我的 build.gradle 的简化 View :

buildscript {
repositories {
mavenCentral()
maven {
url "http://saturday06.github.io/gradle-android-scala-plugin/repository/snapshot"
}
}
dependencies {
// 0.8.3 con Gradle 1.10
classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
}
}

apply plugin: 'idea'

project(':MyApp') {
ext.apl = true
}

project(':MyLibrary') {
ext.apl = false
}

subprojects {
if (project.apl) {
apply plugin: 'android'
dependencies {
compile 'ch.acra:acra:4.5.0'
}
}
if (project.scala) {
apply plugin: 'android-scala'
scala {
target "jvm-1.7"
addparams '-feature'
}
} else {
apply plugin: 'android-library'
}
android {
compileSdkVersion 17
buildToolsVersion '19.1.0'

signingConfigs { ... }
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}

sourceSets {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

buildTypes {
debug {
runProguard false
proguardFile file('proguard-rules.txt')
signingConfig signingConfigs.depurar
}

release {
runProguard true
proguardFile file('proguard-rules.txt')
signingConfig signingConfigs.entregar
}
}
}
}

project(':MyLibrary') {
dependencies {
compile "com.github.tony19:logback-android-core:1.1.1-2"
compile "com.github.tony19:logback-android-classic:1.1.1-2"
compile "org.slf4j:slf4j-api:1.7.6"

}
}

project(':MyApp') {
dependencies {
compile 'com.android.support:appcompat-v7:19.1.0'
compile('org.apache.httpcomponents:httpmime:4.1.1') {
transitive = false
}
compile project(':Bibl')
}
}

我的 settings.gradle 是:

include 'MyLibrary', 'MyApp'

只有一个build.gradle。

问题是 Gradle 提示

Plugin with id 'android-library' not found

每当我尝试使用这个插件时。使用 apply plugin: 'android' 没有问题。

文档明确指出,对于库,必须使用“android-library”。我正在使用 Gradle 1.10。

最新版本的 gradle-android-plugin(如 1.2.1)的文档是否已过时?因为官方文档是0.9版本的。

最佳答案

Is the doc outdated for newest versions of gradle-android-plugin like 1.2.1?

引用 the documentation for gradle-android-plugin :

We are very sorry to announce that development of this plugin has been discontinued. Google has created their own Android development toolchain based on Gradle, which supercedes this plugin.

Please see http://tools.android.com/tech-docs/new-build-system/user-guide for further information.

我通常将 android-library 与官方 Gradle for Android 插件相关联;我不知道已弃用的 gradle-android-plugin 是否支持它。

关于android - Gradle:找不到 ID 为 'android-library' 的插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24036193/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com