Way*_*nch 2 android realm java-8 android-studio
build.gradle 配置\xef\xbc\x9a
\n\napply plugin: \'com.android.application\'\napply plugin: \'realm-android\'\n//apply plugin: \'android-apt\'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion "25.0.0"\n defaultConfig {\n applicationId "com.way.event"\n minSdkVersion 21\n targetSdkVersion 25\n versionCode 1\n versionName "1.0"\n testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"\n jackOptions {\n enabled true\n }\n }\n compileOptions {\n sourceCompatibility JavaVersion.VERSION_1_8\n targetCompatibility JavaVersion.VERSION_1_8\n }\n buildTypes {\n release {\n minifyEnabled false\n proguardFiles getDefaultProguardFile(\'proguard-android.txt\'), \'proguard-rules.pro\'\n }\n }\n}\n\ndependencies {\n compile fileTree(include: [\'*.jar\'], dir: \'libs\')\n androidTestCompile(\'com.android.support.test.espresso:espresso-core:2.2.2\', {\n exclude group: \'com.android.support\', module: \'support-annotations\'\n })\n compile \'com.android.support:appcompat-v7:25.0.0\'\n compile \'com.android.support:design:25.0.0\'\n compile \'com.android.support:support-v4:25.0.0\'\n testCompile \'junit:junit:4.12\'\n}\nRun Code Online (Sandbox Code Playgroud)\n\n它不支持 Java8\xef\xbc\x9a
\n\n\n\n\n错误:无法获取类型为 com.android.build.gradle.internal.pipeline.TransformTask 的任务\n \':app:transformJackWithJackForDebug\' 的未知属性 \'classpath\'。
\n
跟界域有什么关系吗?怎么解决呢?
\n好吧,你仍然可以使用 Retrolambda 代替 Jack,没有人阻止你使用 lambda。
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "io.realm:realm-gradle-plugin:1.2.0"
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
Run Code Online (Sandbox Code Playgroud)
和
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
android {
compileSdkVersion xx
buildToolsVersion "xx"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Run Code Online (Sandbox Code Playgroud)
对于 Java 8 语言功能(lambda、方法引用、try-with-resources)来说效果很好。
| 归档时间: |
|
| 查看次数: |
3485 次 |
| 最近记录: |