can not resolve symbol R

在刚安装完Androidstudio(AS)后的第一个helloworld程序,AS提示can not resolve symbol R。
在build.gradle文件中,我做了如下更改后,跑通AS下第一个程序。
注意点:compileSdkVersion、buildToolsVersion、targetSdkVersion、compile ‘com.android.support:appcompat-v7:22.+’
这几个地方的版本号都得是一样的,比如这里的22,并且确认你的sdk文件夹下有相关版本的buildTools

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.+'
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章