错误:(3)在没有SDK版本23的情况下检索项目的父项时出错

时间:2016-01-15 15:14:56

标签: android gradle android-gradle

我使用版本23构建了我的应用程序但是我遇到了一些权限问题。现在我想回到第22版,但我发现了这个错误:

/Users/m/AndroidStudioProjects/50-anys/app/build/intermediates/res/merged/debug/values-v23/values-v23.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

这是我的gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.main"
        minSdkVersion 14
        targetSdkVersion 22
    }

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

dependencies {
    compile files('libs/Vuforia.jar')

    compile "com.android.support:support-v4:22.2.1"
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-annotations:22.2.1'
    compile 'com.github.paolorotolo:appintro:3.3.0'
}

任何地方都没有。有什么想法吗?

2 个答案:

答案 0 :(得分:2)

我相信这是因为com.github.paolorotolo:appintro:3.3.0也使用了appcompat-v7。

尝试用以下代码替换编译'com.github.paolorotolo:appintro:3.3.0':

compile ('com.github.paolorotolo:appintro:3.3.0'){
    exclude module: 'appcompat-v7'
}

编辑:实际上,com.github.paolorotolo:appintro:3.3.0使用

compile 'com.android.support:appcompat-v7:23.1.1'

你的编译和目标是22,这可能是你的问题。

答案 1 :(得分:1)

在尝试将以下库添加到我的项目时,我也遇到了同样的问题:https://github.com/alamkanak/Android-Week-View

我发现库在build.gradle文件中有这个:

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
}

案例是:我的项目的targetSdkVersion是22,我尝试使用的库需要appcompat用于sdk版本23.

尝试修复它我发现Gradle不允许您使用&appffat-v7:23.1.1'如果您的targetSdkVersion或compileSdkVersion不是 23

解决方案:为了解决这个问题,我将以下内容添加到了我的编译语句中:

compile ('com.github.alamkanak:android-week-view:1.2.6'){
    exclude module: 'appcompat-v7'
}

注意:如果你试试这个,你会发现它有效。但要小心,因为您从库中排除了一个模块,所以这可能会遇到很多问题。 向上帝祈祷它不会发生。