Gradle:
buildscript {
ext.kotlin_version = '1.2.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
=========================
ext {
support_version = '27.0.2'
dagger_version = '2.14.1'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
//support
implementation "com.android.support:appcompat-v7:$support_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//rx
implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
//test
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//Dagger 2
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
provided 'org.glassfish:javax.annotation:10.0-b28'
}
It's work well for me, but if I enable DataBinding:
dataBinding {
enabled = true
}
I got a warning com.android.support:appcompat-v7:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.0.2, 21.0.3. Examples include com.android.support:animated-vector-drawable:27.0.2 and com.android.support:support-v4:21.0.3 more... (Ctrl+F1)
and lost method checkSelfPermission in ContextCompat:
ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_SMS)
Unresolved reference: checkSelfPermission
Why enabling DataBinding leads to such an effect?