2016-12-07 135 views
0

我知道这个问题在这里已经被多次提出,但是没有一个推荐解决方案能够解决。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' 
+1

控制台中的任何错误?你可以发布吗? – Raghavendra

+0

你有没有适当的进口陈述? – Raghavendra

+0

R-指资源。你应该彻底检查资源文件。因为它会在您的应用中提交错误。甚至可能是单点会通过一个错误。样式,字符串,原始,attr,颜色,布局,drawable,动画,菜单甚至自定义xml布局文件或文件夹 – Noorul

回答

0

你应该使用最新版本的火力

compile 'com.google.firebase:firebase-core:10.0.0' 
compile 'com.google.firebase:firebase-auth:10.0.0' 
compile 'com.google.firebase:firebase-database:10.0.0' 
compile 'com.google.android.gms:play-services:10.0.0' 

它可能解决您的问题

+0

我修复了firebase错误,但它仍然无法解析R! –

+1

然后请检查您的资源文件可能有一些错误您的res文件 –

+0

我已经检查过,没有问题的XML文件 –

相关问题