gpt4 book ai didi

java - 无法应用插件 [id 'com.android.library']

转载 作者:太空狗 更新时间:2023-10-29 14:48:15 26 4
gpt4 key购买 nike

我尝试编译一个使用另一个名为 HoloGraphLibrary 的库的 Android 项目。但是当我要编译时出现如下错误:

插件太旧,请更新到较新的版本,或将 ANDROID_DAILY_OVERRIDE 环境变量设置为“9e19705c8c53c2712ca27200bfa349e4757e2264”

错误:(1, 1) 评估项目“:HoloGraphLibrary”时出现问题。

Failed to apply plugin [id 'com.android.library'] Could not create plugin of type 'LibraryPlugin'.

该错误的来源是:

apply plugin: 'com.android.library'

android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

sourceSets {
main {
java.srcDirs = ['src']
res.srcDirs = ['res']
manifest.srcFile 'AndroidManifest.xml'
}
}
}

这是库的build.gradle。应用程序的 build.gradle 如下所示:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "XXXXXXXXXXX"
minSdkVersion 14
targetSdkVersion 21
versionCode 2
versionName '1.0.1'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res/tut', 'src/main/res/tutorial']
resources.srcDirs = ['src/main/resources', 'src/main/resources/te']
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(":HoloGraphLibrary")
}

我只是不知道如何解决这个问题。有什么提示吗?

谢谢

---------------- 编辑----------------

这是顶级 gradle 文件。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-beta1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

不幸的是,G.K.的建议。没有用!

我什至尝试将 ANDROID_DAILY_OVERRIDE 变量设置为它所说的,但同样的错误。

最佳答案

好吧,我刚刚通过替换解决了这个问题

apply plugin: 'com.android.library'

已弃用的版本

apply plugin: 'android-library'

这似乎暂时可行,但我认为这不是最佳解决方案,所以我愿意接受更好的解决方案。

关于java - 无法应用插件 [id 'com.android.library'],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37634608/

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