[英]'sourceSets' cannot be applied to 'groovy.lang.closure' warning in Android Studio
[英]Upgrading Android project to use Java8 (compileOptions cannot be applied to groovy.lang.closure)
我已經對build.gradle
進行了更改以升級我的項目,我在MacOSX上使用Android Studio 2.1 Preview ,這是我的Gradle:
的build.gradle。
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-N'
buildToolsVersion '24.0.0 rc1'
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 21
targetSdkVersion 'N'
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:design:24.0.0-alpha1'
compile 'com.android.support:support-v4:24.0.0-alpha1'
compile 'com.android.support:cardview-v7:24.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:24.0.0-alpha1'
}
Android Studio抱怨'compileOptions cannot be applied to groovy.lang.closure'
我安裝了Android N的工具和SDK,並嚴格按照Google的說明進行操作
編輯:它停止抱怨,但Android可視化設計師給出以下錯誤消息:
Android N requires the IDE to be running with Java 1.8 or later
對我來說,應用上述解決方案並沒有解決問題。 相反,我必須轉到Android Studio中的設置並選擇“使用gradle包裝器” :
在Android Studio中選擇:
文件\\設置\\構建,執行,部署\\構建工具\\ Gradle
( Mac用戶: Android Studio \\ Preferences ... \\ Build,Execution,Deployment \\ Build tools \\ Gradle)
標記:使用默認gradle包裝器(默認)
這刪除了構建文件中的所有“無法應用於”(groovy.lang.Closure')警告。
2.單擊“文件”,然后選擇“使高速緩存無效/重新啟動”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.