这是我的gradle文件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
模块/的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "<package_id>"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dataBinding {
enabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
def gsonVersion = "2.6.2"
def gsonConverterVersion = "2.1.0"
def interceptorVersion = "3.3.0"
def supportVersion = "25.3.1"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
//For Network Call
compile "com.google.code.gson:gson:$gsonVersion"
compile "com.squareup.retrofit2:converter-gson:$gsonConverterVersion"
compile "com.squareup.okhttp3:logging-interceptor:$interceptorVersion"
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'org.greenrobot:eventbus:3.0.0'
}
我已使用以下代码绑定了我的活动
DataBindingUtil.setContentView(this, R.layout.activity_main);
它向我显示以下错误:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/databinding/DataBindingUtil;
我尝试使用Solution 1和Solution 2,但它对我不起作用。
我甚至尝试使用clean and rebuild
和invalidate Caches/Restart
,但这对我没有帮助。
答案 0 :(得分:0)
尝试后没有成功:
./gradlew clean
我解决了以下问题:
.idea/libraries