簡體   English   中英

Android Studio在build.gradle文件中顯示錯誤

[英]Android studio showing error in build.gradle file

我有一個正在運行的項目,而今天,在build.gradle文件中顯示錯誤將近2周后,我進行了設置。 我可能已經安裝了android studio更新。 以下是我在gradle文件中的內容:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
    applicationId "com.shaon.myapp"
    minSdkVersion 19
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    })

    // RecyclerView

    // CardView
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
    testCompile 'junit:junit:4.12'

    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile 'org.jsoup:jsoup:1.7.3'

    compile 'com.android.support:palette-v7:+'
}

和我從生成選項卡進入的錯誤是:

../../Users/xxx/.gradle/caches/transforms-1/files-1.1/appcompat-v7-25.2.0.aar/a15b23bb4246ae6c7bb03ff4cce6bf47/res/values/values.xml    
    error: resource android:attr/fontStyle not found.   
    error: resource android:attr/font not found.    
    error: resource android:attr/fontWeight not found.  
    error: resource android:attr/fontVariationSettings not found.   
    error: resource android:attr/ttcIndex not found.    

同樣在聲明的行上compile 'com.android.support:appcompat-v7:25.2.0'其顯示錯誤:

所有com.android.support庫都必須使用完全相同的版本規范(混合版本可能導致運行時崩潰)。 找到版本28.0.0-alpha1,26.0.0-alpha1,25.2.0。 示例包括com.android.support:collections:28.0.0-alpha1和com.android.support:animated-vector-drawable:26.0.0-alpha1 less ...(Ctrl + F1)有一些庫組合,或者不兼容或可能導致錯誤的工具和庫。 一種不兼容的情況是使用不是最新版本的Android支持庫版本進行編譯(或者特別是低於目標targetSdkVersion的版本)。

我該如何解決?

使用實際版本而不是加號

support:palette-v7:+'

確保該版本與其他v7版本匹配

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM