我知道这个问题在这里已经被多次提出,但是没有一个推荐解决方案能够解决。Android Studio 2.2.3无法解析符号'R'
在编译准备好在Emulator上运行后,我的IDE在R.id属性和R.layout上出现错误。即使我不对文件进行任何更改,每个Java文件也会突然出现相同的错误。 我已经尝试:
File->Invalidata Caches/Restart Invalidata and Restart
Build->Make Module
Build->Make Project
Build->Clean Project
Build->Rebuild Project
这是应用模块我build.grade文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.sabrine.sos_remorquage"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-auth:9.0.1'
compile 'com.google.firebase:firebase-database:9.0.1'
compile 'com.google.android.gms:play-services:9.0.1'
testCompile 'junit:junit:4.12'}
apply plugin: 'com.google.gms.google-services'
控制台中的任何错误?你可以发布吗? – Raghavendra
你有没有适当的进口陈述? – Raghavendra
R-指资源。你应该彻底检查资源文件。因为它会在您的应用中提交错误。甚至可能是单点会通过一个错误。样式,字符串,原始,attr,颜色,布局,drawable,动画,菜单甚至自定义xml布局文件或文件夹 – Noorul