我在尝试构建项目时遇到错误:
Warning:The following options were not recognized by any processor: '[android.databinding.minApi, android.databinding.enableDebugLogs, android.databinding.sdkDir, android.databinding.bindingBuildFolder, android.databinding.enableForTests, android.databinding.modulePackage, android.databinding.generationalFileOutDir, android.databinding.xmlOutDir, android.databinding.artifactType, android.databinding.printEncodedErrors, android.databinding.isTestVariant]'
我不知道这个问题可能是什么原因。 这是我的gradle文件:
build.gradle(项目)
buildscript {
ext.kotlin_version = '1.1.1'
apply from: 'scripts/dependencies.gradle'
apply from: 'scripts/testDependencies.gradle'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
classpath "io.realm:realm-gradle-plugin:2.3.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.6'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
mavenCentral()
}
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.web2print"
minSdkVersion 17
targetSdkVersion 25
versionCode 32
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
signingConfigs {
web2print {
storeFile mainKeystore
storePassword mainKeystorePassword
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules/main.pro'
signingConfig signingConfigs.web2print
}
debug {
jackOptions {
enabled false
testCoverageEnabled = false
}
}
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
android.applicationVariants.all { variant ->
def variants = variant.baseName.split("-")
def apkName = variants[0] + "-v" + variant.mergedFlavor.versionName
apkName += "-build$variant.mergedFlavor.versionCode-"
if (variant.buildType.name == "release") {
apkName += "-release.apk"
} else {
apkName += "-debug.apk"
}
def output = variant.outputs.get(0)
output.outputFile = new File(output.outputFile.parent, apkName)
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile dep.support.appCompat
compile dep.support.cardView
compile dep.support.recyclerView
compile dep.support.design
testCompile 'junit:junit:4.12'
compile 'com.annimon:stream:1.1.7'
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.artemzin.rxjava:proguard-rules:1.1.0.0'
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.7.0@aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.badoo.mobile:android-weak-handler:1.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
compile 'org.parceler:parceler-api:1.1.5'
annotationProcessor 'org.parceler:parceler:1.1.5'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.github.nguyenhoanglam:ImagePicker:1.1.3'
compile dep.moxy.lib
compile dep.moxy.android
compile dep.moxy.appCompat
annotationProcessor dep.moxy.apt
compile dep.timber
compile 'me.grantland:autofittextview:0.2.1'
provided 'org.projectlombok:lombok:1.16.12'
annotationProcessor 'org.projectlombok:lombok:1.16.12'
compile 'com.google.dagger:dagger:2.10'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
gradle-wrapper.properties
#Mon Jan 30 13:25:09 YEKT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip
请帮我找出问题
答案 0 :(得分:0)
kristyna的回答为我解决了这个问题。 https://stackoverflow.com/a/48281160/3708094
我必须将以下行添加到我的应用的build.gradle
文件
kapt "com.android.databinding:compiler:3.0.1"
此行确保Kotlin Annotation Processer知道如何正确处理数据绑定