无法解析符号’支持'(使用Android Studio,以下入门指南)

前端之家收集整理的这篇文章主要介绍了无法解析符号’支持'(使用Android Studio,以下入门指南)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我开始使用 Android开发了.
我已经按照这个 Getting Started指南使用Android Studio(不是eclipse).

我在我的设备上运行了Hello World,到目前为止一直很好.但..

添加此导入时问题开始:(按照指南的说明)

import android.support.v4.app.NavUtils;  // cannot resolve symbol 'support'

看来它需要这一行(评论它并自动解决导入没有工作)

NavUtils.navigateUpFromSaMetask(this);

支持导入是红色下划线,鼠标悬停告诉我无法解析符号’支持

建造不会在任何一个地方工作.我已经看到类似问题的答案,例如;
建议清除缓存和重新启动(试过),
建议以管理员身份运行SDK Manager并更新(尝试过),
和其他一些看似日蚀的问题/解决方案.

我是Android开发和IDE的新手.如何在Android Studio v0.2.9中修复此问题?

编辑:

我的build.gradle文件内容

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

dependencies {

    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // The Support Repository (separate from the corresponding library) can be found in the Extras category.
    // compile 'com.android.support:appcompat-v7:18.0.0'
}

解决方法

修改您的gradle文件,如下所示,并尝试它是否有效.
......

    dependencies {
       compile 'com.android.support:support-v4:18.0.0'

        // You must install or update the Support Repository through the SDK manager to use this dependency.
        // The Support Repository (separate from the corresponding library) can be found in the Extras category.
        // compile 'com.android.support:appcompat-v7:18.0.0'
    }
原文链接:https://www.f2er.com/android/317678.html

猜你在找的Android相关文章