AndroidX遇到ButterKnife
记录下自己在开发过程中的引用
- gradle.properties文件中添加如下代码:
android.enableJetifier=true
android.useAndroidX=true
- build.gradle文件:
android{
defaultConfig {
applicationId "com.fudd.jetpackdemo"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // this
}
//其他...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 // this
targetCompatibility JavaVersion.VERSION_1_8 // this
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// ***** androidx 和 support 冲突
implementation 'androidx.appcompat:appcompat:1.0.2' // this
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // this
testImplementation 'junit:junit:4.12' // this
androidTestImplementation 'androidx.test:runner:1.1.1' // this
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' // this
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0"
//butterknife
//noinspection GradleDependency
implementation 'com.jakewharton:butterknife:10.0.0' // this
//noinspection GradleDependency
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' // this
}