2016-12-07 136 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文件 –

相關問題