【发布时间】:2016-05-19 21:31:55
【问题描述】:
我正在开发一个 Android 应用程序,几天前我将我的 Kotlin 版本从 1.0.0-beta-1103 更新为候选版本 1.0.0-rc-1036 现在我无法运行与 Kotlin Android Extensions 相关的应用程序。
我使用apply plugin: 'kotlin-android-extensions' 就像官方博客所说的http://blog.jetbrains.com/kotlin/2016/02/kotlin-1-0-release-candidate-is-out/ 一样,但我的应用无法识别来自任何布局的任何视图。
这是控制台上显示的内容:
错误:(20, 8) 未解决的参考:kotlinx
错误:任务 ':app:compileDebugKotlin' 执行失败。
编译错误。查看日志了解更多详情
请帮帮我,我疯了!
更新:
这是我在 globalbuild.gradle 中的 buildScript
buildscript {
ext {
kotlin_version = "1.0.0-rc-1036"
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
应用程序build.gradle中列出的依赖项
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// Square
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
// ReactiveX
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.2.0'
// DBFlow
kapt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
compile "com.raizlabs.android:DBFlow-Core:2.2.1"
compile "com.raizlabs.android:DBFlow:2.2.1"
// Otros
compile 'de.hdodenhof:circleimageview:1.3.0'
// SQLite Assets Helper
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true
}
}
这是我正在使用的导入:
import kotlinx.android.synthetic.main.activity_all_quizzes.*
【问题讨论】:
-
能否将您的
buildscript和build.gradle中列出的插件包括在内?您使用的导入是什么? -
干净的构建不起作用?
-
不,我已经尝试过 clean 但它不起作用
标签: android gradle android-gradle-plugin kotlin kotlin-android-extensions