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

时间:2015-05-24 11:58:30

标签: android android-studio

我在导入时无法解决错误 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)     改变之后。

  5. 我还是无法重拍这个。请帮助

    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>
    

3 个答案:

答案 0 :(得分:2)

替换

 import android.support.v4.app.NotificationCompat;

pause

答案 1 :(得分:0)

抱歉,我无法发表评论。 尝试使用

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

较低版本为我修复了这个问题。

答案 2 :(得分:-1)

右键单击您的项目,选择打开模块设置,然后在模块设置窗口中,单击 Modules / app 。然后在窗口的右侧选择依赖关系 TAB。然后按加号并选择“库依赖”。 在新显示的窗口中,选择您的支持库,然后点击确定

相关问题