Reputation: 406
I am facing a peculiar problem. i have upgraded my project from 23 api to 28. after upgrading, from my activity there showing cannot resolve R but while i run its building apk successfully and app running well without any showing any error. 2 more UI name also not recognizing in "setContentView" i have check that UIs no problem there. how to check for more specifically for UI error if exist.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
all*.exclude group: 'xpp3', module: 'xpp3'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
repositories {
jcenter()
maven { url "https://dl.bintray.com/hani-momanii/maven" }
}
aaptOptions {
cruncherEnabled = false
}
lintOptions {
checkReleaseBuilds false
//If you want to continue even if errors found use following line
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
implementation 'com.google.gdata:core:1.47.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.github.lovetuzitong:MultiImageSelector:1.2'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.iarcuschin:simpleratingbar:0.1.5'
implementation 'com.droidninja:filepicker:2.1.1'
implementation 'com.google.android:flexbox:1.0.0'
implementation 'com.felipecsl.asymmetricgridview:library:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
build.gradle:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
can anyone please help me.
Upvotes: 3
Views: 2453
Reputation: 45
I had a similar problem that occurred when pulling updates from my master Github branch. The resource files were there and named correctly, the app still worked fine but all of the resource identifiers in one of my classes were highlighted red. I solved this by restarting Android Studio and the errors went away.
Upvotes: 0
Reputation: 4446
After Rebuild Project click Tools -> Android -> Sync Project with Gradle Files
Upvotes: 0
Reputation: 9656
There are a few reasons for this problem and also a few solutions:
First thing to try is to Invalidate caches and restart, usually it's just an Android Studio caching problem
If that doesn't work you might have a Gradle/Android Studio version problem. Usually when you upgrade your compile SDK, also the gradle version needs to be updated, but Android Studio complains with the error you are getting (already happened to me). Also update your Android Studio to the latest stable version (my guess goes to this solution to your problem)
Upvotes: 1