Dr3*_*k13 6 java android gradle android-studio
我尝试编译一个使用另一个名为 HoloGraphLibrary 的库的 Android 项目。但是当我想编译时出现以下错误:
插件太旧,请更新到最新版本,或将 ANDROID_DAILY_OVERRIDE 环境变量设置为“9e19705c8c53c2712ca27200bfa349e4757e2264”
错误:(1, 1) 评估项目“:HoloGraphLibrary”时出现问题。
无法应用插件 [id 'com.android.library'] 无法创建类型为“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'
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是图书馆的 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")
}
Run Code Online (Sandbox Code Playgroud)
我只是不知道如何解决这个问题。任何提示?
谢谢
- - - - - - - - 编辑 - - - - - - - -
这是顶级 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()
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,GK 的建议没有奏效!
我什至试图将 ANDROID_DAILY_OVERRIDE 变量设置为它所说的,但同样的错误。
好吧,我刚刚通过替换解决了这个问题
apply plugin: 'com.android.library'
Run Code Online (Sandbox Code Playgroud)
及其已弃用的版本
apply plugin: 'android-library'
Run Code Online (Sandbox Code Playgroud)
目前看来这可行,但我认为这不是最佳解决方案,因此我愿意接受更好的解决方案。
| 归档时间: |
|
| 查看次数: |
14361 次 |
| 最近记录: |