【发布时间】:2018-10-11 04:57:28
【问题描述】:
我正在尝试在我的项目中测试一些 android jetpack 功能,我已经可以使用导航了。当我尝试导入 android-ktx 并将我的依赖项迁移到 androidx 时,我成功地同步了 gradle,但我无法通过合成访问我的按钮。
有人知道它是什么吗?
我的摇篮:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.qmakercorp.qmaker"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.support.test.runner.AndroidJUnitRunner"
}
androidExtensions {
experimental = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-beta01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-beta01'
implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha06"
implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha06"
androidTestImplementation 'androidx.test:rules:1.1.0-beta01'
implementation 'androidx.core:core-ktx:1.0.0'
我的片段:
【问题讨论】:
-
invlidate 缓存/重启可能会有所帮助
标签: android kotlin android-jetpack