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.+'
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章