繁体   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