"can not resolve R" android studio


Hi I have this problem in all my projects in android studio and probe with "clear project" and with Tools "- >" Android "- >" Sync Project with Gradle Files ". And the problem continues, that another solution could please suggest me.

android.gradle (module)

android {
compileSdkVersion 21
buildToolsVersion '21.1.2'

defaultConfig {
    applicationId "com.example.diego.tpfinal"
    minSdkVersion 9
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

android.gradle (project)

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the [![Consola de android studio][1]][1]individual module build.gradle files

Updated ---- build.gradle (module)

Solution: I fixed my problem with the following video and Elena's comments previously. link

asked by Diego 05.06.2016 в 02:23

1 answer


The problem of not being able to generate the class R.java is generally due to an error in the resources.

Check some red x that indicates a problem or check the messages.

Try a Clean Project > Build , if this does not solve it, it will surely show what the problem is.


You have to check that you have installed the API 23, that you verify in the Android SDK Manager.

and ensure within your build.gradle that you have the version you downloaded

answered by 05.06.2016 / 02:33