• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps The R.layout is giving an error

It started yesterday.
I was coding an app. I had completed the layout xml file and had started on the java file.
After extending Activity and overriding he OnCreate method. I used setContentView. But when I enter R.layout.theXmlFile. The R is showing an error as "Cannot Resolve Symbol R". I googled a lot, cleaned, build and make the project but nothing seems to do it right.
Help!!!!

PS: I am using Android Studio.
 
Open the Gradle console window. If there are errors in building your project then they will be shown here. A successful build looks like this (see attached image).
By 'build' I mean the process of compiling all your code, and assembling resources like images and icons into a package (.apk).
The file 'R' is automatically generated during the build process. It's created based on the layouts you have defined. If there is one (or more) problems found in your layout files, the file will not be created, and your Java code will report unresolved symbols.

android_build.png
 
Upvote 0
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:22.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
file:/C:/android setup/android-sdk/android-sdk/extras/android/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
file:/C:/android setup/android-sdk/android-sdk/extras/android/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
file:/C:/android setup/android-sdk/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
file:/C:/android setup/android-sdk/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
Required by:
EMobStore:app:unspecified > com.android.support:appcompat-v7:21.0.3

> Could not find com.android.support:support-v4:22.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
file:/C:/android setup/android-sdk/android-sdk/extras/android/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
file:/C:/android setup/android-sdk/android-sdk/extras/android/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
file:/C:/android setup/android-sdk/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
file:/C:/android setup/android-sdk/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.aar
Required by:
EMobStore:app:unspecified > com.google.android.gms:play-services-appindexing:8.1.0 > com.google.android.gms:play-services-basement:8.1.0


This is the error file. The bold is where it is showing error. What should I do??
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones