I tried to add a new project using the existing template Navigation Drawer Activity. It really works well. However, I accidentally deleted the mobile_navigation.xml in res/navigation. Now that every time I tried to open a simple template (even if it is not Navigation Drawer Activity) I'm getting the below error message.
I tried:
- File/Invalidate Cache/Restart: but it doesn't work
- I found this
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'to update gradle but I think it is for kotlin. I'm using Java on Android Studio 3.6.2 - I even tried creating a new project using templates Botton Navigation Activity. However, it is also not working and the same error occurs.
- I even tried Empty Activity. Then it is weird that I'm getting an
Android resource linking failederror. And it directs to a .XML (value.xml) of some of my other projects in a different folder which is not even related to this new project. I didn't even open it.
I would appreciate any suggestion to fix this. Thank you!
build.gradle is as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

