Search code examples
androidandroid-studioandroid-appcompatr.java-file

error : can not reslove symbol 'R' whenever I'm trying to add appcompat-v7:22.0.0 dependency


I'm working on a project built on the support-v4:22.0.0 dependency. Now I'm trying to add the Google Maps Activity.For adding Google Maps, appcompat-v7:22.0.0 dependency is adding to the Gradle. After adding this activity I'm getting the error in the Gradle Build Error:(1) Error retrieving parent for item: No resource found that matches the given name 'xxxxxx:xxxxxxxxxxxx'. And also its showing Error: can not resolve 'R'.

I tried cleaning the project, syncing the Gradle, restarting the Andrid Studio. But nothing turned up. Please help me out


Solution

  • Found the answer by myself.

    Changing the compileSdkVersion and targetSdkVersion to 21 in src/build.gradle did the job for me.

    android {
        compileSdkVersion 21
        ..........
    
        defaultConfig {
           ...........
           ...........
           targetSdkVersion 21
        }