![](/img/trans.png)
[英]Failed to apply plugin [id 'com.android.internal.application']
[英]Failed to apply plugin [id 'com.android.library']
我嘗試編譯一個使用另一個名為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'
}
}
}
這是庫的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()
}
}
不幸的是,GK的建議沒有用!
我甚至試圖將ANDROID_DAILY_OVERRIDE變量設置為它所說的,但同樣的錯誤。
我剛剛通過更換解決了這個問題
apply plugin: 'com.android.library'
已棄用的版本
apply plugin: 'android-library'
這似乎現在有效,但我不認為這是最佳解決方案,因此我對更好的解決方案持開放態度。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.