java - 无法实现 Android 设计支持库

标签 java android android-studio gradle libraries

我一直在尝试实现 Android 的设计支持库,但没有成功。我已按照 here 中的步骤进行操作.在 出现几个问题后警告:与依赖项 'com.android.support:support-annotations' 发生冲突。应用程序 (xxx) 和测试应用程序 (xxx) 的已解决版本不同。 我设法解决了这个问题。但是现在我收到一个新错误: enter image description here

我会在下面发布我的 .gradle 文件,也许你们可以帮助我。我删除了有关导致初始警告的单元测试和仪器测试的所有内容。

(1)

buildscript {
repositories
        {
            mavenCentral()
        }
dependencies
        {
            classpath 'com.android.tools.build:gradle:1.3.0'
            classpath 'com.newrelic.agent.android:agent-gradle-plugin:5.+'
            classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.0.2'
        }
}

allprojects
        {
        repositories
                {
                    mavenCentral()
                }
    }

(2)

 apply plugin: 'com.android.application'
apply plugin: 'newrelic'
apply plugin: 'spoon'
//apply plugin: 'jacoco' // Not working at the moment

android {
    compileSdkVersion 21
    buildToolsVersion '23.0.1'
    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 21
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            debuggable false
            jniDebuggable false
        }
        debug {
            debuggable true
            testCoverageEnabled = false
        }
    }
    productFlavors {
        standard
        motorola
        honeywell
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    sourceSets {
        main {
            java.srcDirs = ['src/main/java']
}
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.newrelic.agent.android:android-agent:5.+'

    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:percent:23.0.1'


    compile files('libs/redlasersdk.jar')
    provided files('libs/com.symbol.emdk.jar') // Assuming the build does not need symbols compiled
    standardCompile files('libs/com.symbol.emdk.jar')
    // Compiling the EMDK symbols for non-motorola flavors
    honeywellCompile files('libs/com.symbol.emdk.jar')
    // Compiling the EMDK symbols for non-motorola flavors
    compile files('libs/honeywell.jar')

   spoon {
    debug = true
}

 apply from: "../artifacts.gradle" 

编辑 1:SDK 管理器中的所有内容都是最新的。

最佳答案

使用compileSdkVersion 23

添加

使用 android.support.v7.widget,Widget.Material 仅适用于最低 SDK 21

关于java - 无法实现 Android 设计支持库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32839817/

相关文章:

Java,从多个类调用AlertDialog

Java 类实例

java - 当图像路径更改时,JPanel 中的图像未更新

android - 如何在 Eclipse 中安装 Android 4.0 (API 14)?

android - 如何制作像 Lollipop 中的联系人应用程序一样的工具栏动画

android - 在 Android Studio 中修改 compileSdkVersion 报错

java - 如何在 SQLite android 中保存和检索路径图像

android 如何处理服务被操作系统或任务管理器终止的情况

java - 无法启动守护进程。请问我该如何解决

android - 如何在 Android Studio/IntelliJ 中导入 Maven 依赖项?