簡體   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