Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My R in library is red but I can build and run app normally

I use compile project(':pickphotos') to include a library named pickphotos.

The R in pickphotos is red though I have me.crosswall.photo.pick.R.I can build and run the app normally.

enter image description here

When I use Alt+Enter , it shows some solution:

enter image description here

When I use Move 'R' in pickphotos, it shows some R:

enter image description here

But if I pick me.crosswall.photo.pick.R,I will get repeat R error in my next build.

Below is the build.gradle of pickphotos:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

dependencies {

}

I can also find it app/build/generated/source/r:

enter image description here

There is no Mark as item in menu in Android Studio:

enter image description here

like image 648
tiny sunlight Avatar asked Jan 21 '16 03:01

tiny sunlight


1 Answers

I finally resloved it.

Just Make Project.

R is created when Make Project.

I think when we Run Project or Build Project,Android Studio doesn't Make Project for some reason.

like image 109
tiny sunlight Avatar answered Oct 22 '22 14:10

tiny sunlight