'cannot resolve symbol R' android studio error





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Execution failed for task :app:mergeDebugResources.
What is this error and how to I fix it?



<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>


This is my xml above... and below is onCreate() where setContentView(R.layout.activity_main)
is causing the problem:




cannot resolve symbol R




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

provider = locationManager.getBestProvider(new Criteria(), false);

// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}









share|improve this question




















  • 2





    Clean-Rebuild-Restart & import import PackageName.R

    – IntelliJ Amiya
    Feb 8 '16 at 5:13













  • make sure all resource as same package in manifest .mainactivity is with red sign?

    – Ajay Pandya
    Feb 8 '16 at 5:16






  • 1





    When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

    – Gueorgui Obregon
    Feb 8 '16 at 5:25








  • 1





    Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

    – Devrath
    Feb 8 '16 at 5:28











  • Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

    – Adam Goldberg
    Feb 8 '16 at 5:32


















0















Execution failed for task :app:mergeDebugResources.
What is this error and how to I fix it?



<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>


This is my xml above... and below is onCreate() where setContentView(R.layout.activity_main)
is causing the problem:




cannot resolve symbol R




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

provider = locationManager.getBestProvider(new Criteria(), false);

// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}









share|improve this question




















  • 2





    Clean-Rebuild-Restart & import import PackageName.R

    – IntelliJ Amiya
    Feb 8 '16 at 5:13













  • make sure all resource as same package in manifest .mainactivity is with red sign?

    – Ajay Pandya
    Feb 8 '16 at 5:16






  • 1





    When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

    – Gueorgui Obregon
    Feb 8 '16 at 5:25








  • 1





    Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

    – Devrath
    Feb 8 '16 at 5:28











  • Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

    – Adam Goldberg
    Feb 8 '16 at 5:32














0












0








0








Execution failed for task :app:mergeDebugResources.
What is this error and how to I fix it?



<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>


This is my xml above... and below is onCreate() where setContentView(R.layout.activity_main)
is causing the problem:




cannot resolve symbol R




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

provider = locationManager.getBestProvider(new Criteria(), false);

// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}









share|improve this question
















Execution failed for task :app:mergeDebugResources.
What is this error and how to I fix it?



<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>


This is my xml above... and below is onCreate() where setContentView(R.layout.activity_main)
is causing the problem:




cannot resolve symbol R




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

provider = locationManager.getBestProvider(new Criteria(), false);

// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}






java android xml android-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 8 '16 at 7:49









Sreehari

4,24911642




4,24911642










asked Feb 8 '16 at 5:10









Adam GoldbergAdam Goldberg

93311




93311








  • 2





    Clean-Rebuild-Restart & import import PackageName.R

    – IntelliJ Amiya
    Feb 8 '16 at 5:13













  • make sure all resource as same package in manifest .mainactivity is with red sign?

    – Ajay Pandya
    Feb 8 '16 at 5:16






  • 1





    When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

    – Gueorgui Obregon
    Feb 8 '16 at 5:25








  • 1





    Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

    – Devrath
    Feb 8 '16 at 5:28











  • Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

    – Adam Goldberg
    Feb 8 '16 at 5:32














  • 2





    Clean-Rebuild-Restart & import import PackageName.R

    – IntelliJ Amiya
    Feb 8 '16 at 5:13













  • make sure all resource as same package in manifest .mainactivity is with red sign?

    – Ajay Pandya
    Feb 8 '16 at 5:16






  • 1





    When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

    – Gueorgui Obregon
    Feb 8 '16 at 5:25








  • 1





    Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

    – Devrath
    Feb 8 '16 at 5:28











  • Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

    – Adam Goldberg
    Feb 8 '16 at 5:32








2




2





Clean-Rebuild-Restart & import import PackageName.R

– IntelliJ Amiya
Feb 8 '16 at 5:13







Clean-Rebuild-Restart & import import PackageName.R

– IntelliJ Amiya
Feb 8 '16 at 5:13















make sure all resource as same package in manifest .mainactivity is with red sign?

– Ajay Pandya
Feb 8 '16 at 5:16





make sure all resource as same package in manifest .mainactivity is with red sign?

– Ajay Pandya
Feb 8 '16 at 5:16




1




1





When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

– Gueorgui Obregon
Feb 8 '16 at 5:25







When you build your project there is no warning or error? Also try to close and open AS again, sometimes that works for me

– Gueorgui Obregon
Feb 8 '16 at 5:25






1




1





Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

– Devrath
Feb 8 '16 at 5:28





Did you check are there any errors in xml files, Then cleaning the project and running should fix this !

– Devrath
Feb 8 '16 at 5:28













Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

– Adam Goldberg
Feb 8 '16 at 5:32





Cleaning and running isn't fixing the problem. There are no errors in the xml. the only error is coming form the symbol R

– Adam Goldberg
Feb 8 '16 at 5:32












6 Answers
6






active

oldest

votes


















4














Another solution, If anyone need it



I was using gradle 3.3.0. It was the main culprit. Wasted 6.50 hours from my life. Gradle 3.2.1 removed the error.



classpath 'com.android.tools.build:gradle:3.2.1'





share|improve this answer
























  • Worked for me! Thank you!

    – alex87
    Feb 1 at 6:45











  • Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

    – Rishab Jaiswal
    Apr 10 at 6:10



















3














'cannot resolve symbol R' error usually occurs and the 'symbol R' turns red in color whenever the gradle sync is not completed.
Hence before running any project it is always advisable to first sync the project if any dependencies or anything have been added and then clean the project and then run it.



It should solve your problem.






share|improve this answer































    1














    R is predefined class in android.
    you should clean your project and then build it again. it will resolve R.






    share|improve this answer
























    • Or there is an error somewhere that isn't obvious and it can't automatically be generated

      – cricket_007
      Feb 8 '16 at 5:30











    • But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

      – ojus kulkarni
      Feb 8 '16 at 5:47











    • A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

      – cricket_007
      Feb 8 '16 at 5:50



















    1














    Go to the file directory.




    1. Click "app"

    2. Click "com.example.?????"

    3. Right Click

    4. Hover over "New"

    5. Click on "Java Class"

    6. Name the file "R" and leave the other things blank & accept the defaults

    7. Click OK

      You have finished the first part!

    8. Click File

    9. Hover over "New"

    10. Click "New Project"

    11. Accept all defaults until you've reached the layout xml file

    12. Click "app"

    13. Click "com.example.android.?????"

    14. Click "R"

    15. Select all

    16. Go back to your old file

    17. Paste

    18. Finished!






    share|improve this answer

































      0














      probably your gradle sync failed , that is why it cannot be resolved resync the gradle or you have not imported yourpackagename.R;






      share|improve this answer































        0














        Only this solution worked for me:



        1- Go to your app directory -> /app/src/main/res/



        2- Delete folder XML (Make sure that you don't have important files inside it)






        share|improve this answer


























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35262690%2fcannot-resolve-symbol-r-android-studio-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          Another solution, If anyone need it



          I was using gradle 3.3.0. It was the main culprit. Wasted 6.50 hours from my life. Gradle 3.2.1 removed the error.



          classpath 'com.android.tools.build:gradle:3.2.1'





          share|improve this answer
























          • Worked for me! Thank you!

            – alex87
            Feb 1 at 6:45











          • Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

            – Rishab Jaiswal
            Apr 10 at 6:10
















          4














          Another solution, If anyone need it



          I was using gradle 3.3.0. It was the main culprit. Wasted 6.50 hours from my life. Gradle 3.2.1 removed the error.



          classpath 'com.android.tools.build:gradle:3.2.1'





          share|improve this answer
























          • Worked for me! Thank you!

            – alex87
            Feb 1 at 6:45











          • Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

            – Rishab Jaiswal
            Apr 10 at 6:10














          4












          4








          4







          Another solution, If anyone need it



          I was using gradle 3.3.0. It was the main culprit. Wasted 6.50 hours from my life. Gradle 3.2.1 removed the error.



          classpath 'com.android.tools.build:gradle:3.2.1'





          share|improve this answer













          Another solution, If anyone need it



          I was using gradle 3.3.0. It was the main culprit. Wasted 6.50 hours from my life. Gradle 3.2.1 removed the error.



          classpath 'com.android.tools.build:gradle:3.2.1'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 21 at 9:06









          SHAH MD MONIRUL ISLAMSHAH MD MONIRUL ISLAM

          2,58041532




          2,58041532













          • Worked for me! Thank you!

            – alex87
            Feb 1 at 6:45











          • Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

            – Rishab Jaiswal
            Apr 10 at 6:10



















          • Worked for me! Thank you!

            – alex87
            Feb 1 at 6:45











          • Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

            – Rishab Jaiswal
            Apr 10 at 6:10

















          Worked for me! Thank you!

          – alex87
          Feb 1 at 6:45





          Worked for me! Thank you!

          – alex87
          Feb 1 at 6:45













          Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

          – Rishab Jaiswal
          Apr 10 at 6:10





          Worked for me!! Ideally, Gradle plugin version given in script(build.gradle of project) should match gradle plugin version of IDE

          – Rishab Jaiswal
          Apr 10 at 6:10













          3














          'cannot resolve symbol R' error usually occurs and the 'symbol R' turns red in color whenever the gradle sync is not completed.
          Hence before running any project it is always advisable to first sync the project if any dependencies or anything have been added and then clean the project and then run it.



          It should solve your problem.






          share|improve this answer




























            3














            'cannot resolve symbol R' error usually occurs and the 'symbol R' turns red in color whenever the gradle sync is not completed.
            Hence before running any project it is always advisable to first sync the project if any dependencies or anything have been added and then clean the project and then run it.



            It should solve your problem.






            share|improve this answer


























              3












              3








              3







              'cannot resolve symbol R' error usually occurs and the 'symbol R' turns red in color whenever the gradle sync is not completed.
              Hence before running any project it is always advisable to first sync the project if any dependencies or anything have been added and then clean the project and then run it.



              It should solve your problem.






              share|improve this answer













              'cannot resolve symbol R' error usually occurs and the 'symbol R' turns red in color whenever the gradle sync is not completed.
              Hence before running any project it is always advisable to first sync the project if any dependencies or anything have been added and then clean the project and then run it.



              It should solve your problem.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 8 '16 at 7:10









              UserName_UntoldUserName_Untold

              145112




              145112























                  1














                  R is predefined class in android.
                  you should clean your project and then build it again. it will resolve R.






                  share|improve this answer
























                  • Or there is an error somewhere that isn't obvious and it can't automatically be generated

                    – cricket_007
                    Feb 8 '16 at 5:30











                  • But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                    – ojus kulkarni
                    Feb 8 '16 at 5:47











                  • A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                    – cricket_007
                    Feb 8 '16 at 5:50
















                  1














                  R is predefined class in android.
                  you should clean your project and then build it again. it will resolve R.






                  share|improve this answer
























                  • Or there is an error somewhere that isn't obvious and it can't automatically be generated

                    – cricket_007
                    Feb 8 '16 at 5:30











                  • But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                    – ojus kulkarni
                    Feb 8 '16 at 5:47











                  • A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                    – cricket_007
                    Feb 8 '16 at 5:50














                  1












                  1








                  1







                  R is predefined class in android.
                  you should clean your project and then build it again. it will resolve R.






                  share|improve this answer













                  R is predefined class in android.
                  you should clean your project and then build it again. it will resolve R.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 8 '16 at 5:27









                  ojus kulkarniojus kulkarni

                  1,51221634




                  1,51221634













                  • Or there is an error somewhere that isn't obvious and it can't automatically be generated

                    – cricket_007
                    Feb 8 '16 at 5:30











                  • But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                    – ojus kulkarni
                    Feb 8 '16 at 5:47











                  • A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                    – cricket_007
                    Feb 8 '16 at 5:50



















                  • Or there is an error somewhere that isn't obvious and it can't automatically be generated

                    – cricket_007
                    Feb 8 '16 at 5:30











                  • But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                    – ojus kulkarni
                    Feb 8 '16 at 5:47











                  • A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                    – cricket_007
                    Feb 8 '16 at 5:50

















                  Or there is an error somewhere that isn't obvious and it can't automatically be generated

                  – cricket_007
                  Feb 8 '16 at 5:30





                  Or there is an error somewhere that isn't obvious and it can't automatically be generated

                  – cricket_007
                  Feb 8 '16 at 5:30













                  But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                  – ojus kulkarni
                  Feb 8 '16 at 5:47





                  But there are only two possibilities, either R is not imported properly or its not used properly. so in most of the cases it resolve using clean and build process.

                  – ojus kulkarni
                  Feb 8 '16 at 5:47













                  A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                  – cricket_007
                  Feb 8 '16 at 5:50





                  A clean and a build won't fix improper layout xml, which causes R not to be generated, that's all I'm saying

                  – cricket_007
                  Feb 8 '16 at 5:50











                  1














                  Go to the file directory.




                  1. Click "app"

                  2. Click "com.example.?????"

                  3. Right Click

                  4. Hover over "New"

                  5. Click on "Java Class"

                  6. Name the file "R" and leave the other things blank & accept the defaults

                  7. Click OK

                    You have finished the first part!

                  8. Click File

                  9. Hover over "New"

                  10. Click "New Project"

                  11. Accept all defaults until you've reached the layout xml file

                  12. Click "app"

                  13. Click "com.example.android.?????"

                  14. Click "R"

                  15. Select all

                  16. Go back to your old file

                  17. Paste

                  18. Finished!






                  share|improve this answer






























                    1














                    Go to the file directory.




                    1. Click "app"

                    2. Click "com.example.?????"

                    3. Right Click

                    4. Hover over "New"

                    5. Click on "Java Class"

                    6. Name the file "R" and leave the other things blank & accept the defaults

                    7. Click OK

                      You have finished the first part!

                    8. Click File

                    9. Hover over "New"

                    10. Click "New Project"

                    11. Accept all defaults until you've reached the layout xml file

                    12. Click "app"

                    13. Click "com.example.android.?????"

                    14. Click "R"

                    15. Select all

                    16. Go back to your old file

                    17. Paste

                    18. Finished!






                    share|improve this answer




























                      1












                      1








                      1







                      Go to the file directory.




                      1. Click "app"

                      2. Click "com.example.?????"

                      3. Right Click

                      4. Hover over "New"

                      5. Click on "Java Class"

                      6. Name the file "R" and leave the other things blank & accept the defaults

                      7. Click OK

                        You have finished the first part!

                      8. Click File

                      9. Hover over "New"

                      10. Click "New Project"

                      11. Accept all defaults until you've reached the layout xml file

                      12. Click "app"

                      13. Click "com.example.android.?????"

                      14. Click "R"

                      15. Select all

                      16. Go back to your old file

                      17. Paste

                      18. Finished!






                      share|improve this answer















                      Go to the file directory.




                      1. Click "app"

                      2. Click "com.example.?????"

                      3. Right Click

                      4. Hover over "New"

                      5. Click on "Java Class"

                      6. Name the file "R" and leave the other things blank & accept the defaults

                      7. Click OK

                        You have finished the first part!

                      8. Click File

                      9. Hover over "New"

                      10. Click "New Project"

                      11. Accept all defaults until you've reached the layout xml file

                      12. Click "app"

                      13. Click "com.example.android.?????"

                      14. Click "R"

                      15. Select all

                      16. Go back to your old file

                      17. Paste

                      18. Finished!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Aug 12 '18 at 16:34









                      Stanislav Kralin

                      7,98942043




                      7,98942043










                      answered Aug 12 '18 at 16:17









                      Franklin LeeFranklin Lee

                      112




                      112























                          0














                          probably your gradle sync failed , that is why it cannot be resolved resync the gradle or you have not imported yourpackagename.R;






                          share|improve this answer




























                            0














                            probably your gradle sync failed , that is why it cannot be resolved resync the gradle or you have not imported yourpackagename.R;






                            share|improve this answer


























                              0












                              0








                              0







                              probably your gradle sync failed , that is why it cannot be resolved resync the gradle or you have not imported yourpackagename.R;






                              share|improve this answer













                              probably your gradle sync failed , that is why it cannot be resolved resync the gradle or you have not imported yourpackagename.R;







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Feb 8 '16 at 5:14









                              Cold FireCold Fire

                              11k62751




                              11k62751























                                  0














                                  Only this solution worked for me:



                                  1- Go to your app directory -> /app/src/main/res/



                                  2- Delete folder XML (Make sure that you don't have important files inside it)






                                  share|improve this answer






























                                    0














                                    Only this solution worked for me:



                                    1- Go to your app directory -> /app/src/main/res/



                                    2- Delete folder XML (Make sure that you don't have important files inside it)






                                    share|improve this answer




























                                      0












                                      0








                                      0







                                      Only this solution worked for me:



                                      1- Go to your app directory -> /app/src/main/res/



                                      2- Delete folder XML (Make sure that you don't have important files inside it)






                                      share|improve this answer















                                      Only this solution worked for me:



                                      1- Go to your app directory -> /app/src/main/res/



                                      2- Delete folder XML (Make sure that you don't have important files inside it)







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Jan 6 at 14:35

























                                      answered Jan 4 at 14:13









                                      زيادزياد

                                      49359




                                      49359






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35262690%2fcannot-resolve-symbol-r-android-studio-error%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Monofisismo

                                          Angular Downloading a file using contenturl with Basic Authentication

                                          Olmecas