After starting an android studio today, I came across a strange problem. It was saying
DSL element 'android.viewBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.viewBinding'.
After searching for a bit I found out that I had to use
buildFeatures {viewBinding = true}
instead. So, I replaced viewBinding{enabled=true} with the above one. After that, the real problems started. AAPT can no longer detect my drawables. Here is my buildScript:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.techtrixbd.RestaurantApp"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {viewBinding = true}
}
I don't know what is going on anymore. Any advice will be a big help.
I have solved the issue. I had to move my resources to drawable-v24 folder. that's it. But, don't why it was required because everything was working fine yesterday. Maybe an update has something to do with it. I will look for the cause and will post if I come up with something.