繁体   English   中英

导入android.support.v7.app无法解析

[英]Import android.support.v7.app cannot be resolved

导入android.support.v7.app.Fragment时出现无法解决的错误。

我尝试了所有在不同线程中给出的解决方案。 我缺少什么吗,请帮忙。

  1. 我已经下载了android支持库。
  2. minSdkVersion 14 targetSdkVersion 14
  3. 依赖添加库

     dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:support-v4:22.1.1' } 
  4. 更改后,同步build.gradle文件(右键单击文件->同步“ build.gradle”),然后清理项目(Build-> Clean Project)。

我仍然无法重新爱上它。 请帮忙

build.gradle(模块:应用)

    apply plugin: 'com.android.application'
    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.android.effectivenavigation"
        minSdkVersion 14
        targetSdkVersion 14
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:support-v4:22.1.1'
}

AndroidManifest.xml中

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.android.effectivenavigation"
        android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk android:minSdkVersion="14" />

    <application android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:theme="@android:style/Theme.Holo.Light.DarkActionBar">

        <activity android:name=".MainActivity" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".CollectionDemoActivity" android:label="@string/demo_collection" />

    </application>
</manifest>

更换

 import android.support.v7.app.NotificationCompat;

 import android.support.v4.app.NotificationCompat;

对不起,我不能发表评论。 尝试使用

compile 'com.android.support:support-v4:21.0.+'

较低的版本为我解决。

右键单击您的项目,选择“ 打开模块设置” ,然后在模块设置窗口中,单击“ 模块/应用程序” 然后在窗口的右侧选择Dependencies TAB。 然后按加号,然后选择“ 库依赖项 ”。 在新显示的窗口中,选择您的支持库,然后单击“ 确定”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM