0

When I upgraded AndroidStudio from 0.8 (or 0.9) to 1.0.2 AndroidStudio was not able to resolve my R file and suggests importing it (import my.package.R). I'm using SDK Tools 24.0.2 and SDK Platform-tools 21.

I've tried cleaning, resynching and rebuilding the project, as well as checking the layout files for errors, but I didn't find anything.

Another weird thing is that when typing "R.layout" AndroidStudio suggests either "android.R" or "my.package.app.R". When chosing the former I'm not able to use my layout files, when chosing the later it automatically imports "my.package.app.R"

When importing R a co-worker of mine is even able to run the app...

This is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 16
    buildToolsVersion "20.0.0"
    defaultConfig {
        applicationId "my.package.app"
        minSdkVersion 14
        targetSdkVersion 20
        versionCode 6
        versionName '0.1.6'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

I think it could be of use to some of you here. Thanks!

Edit: I was told that it is perfectly normal to import one's own R class. Sorry for the inconvenience...

Azulath
  • 126
  • 1
  • 7
  • Please check my answer . elaborate here http://stackoverflow.com/questions/27016385/error26-0-gradle-dsl-method-not-found-runproguard/27342403#27342403 try this – IntelliJ Amiya Feb 04 '15 at 05:32

2 Answers2

1

If is showing error (red signed) and is not compiling I'm pretty sure there is something wrong in at least one XML file (like a tag unclosed).

Victor Viola
  • 575
  • 1
  • 4
  • 14
0

I had same kind of error in Android Studio , the reason it gives Red Mark is due to some small errors , ending or opening tags are not been properly closed or opened!

Suraj Palwe
  • 2,080
  • 3
  • 26
  • 42