程序类型已存在:android.support.v4.R

时间:2018-05-27 06:13:48

标签: java android android-gradle

我正在尝试生成一个已签名的apk,我收到错误:

  

程序类型已存在:android.support.v4.R

我尝试从某些依赖项中排除support-v4。但这没有任何帮助。我已经找到了答案,但没有人能解决我的问题。 但该应用程序在调试模式下运行良好。

非常感谢您在这件事上的时间和帮助。

这是我的gradle应用文件:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.example.android.puchotask1"
            minSdkVersion 15
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }


    }


    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        //noinspection GradleCompatible
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        implementation 'com.facebook.fresco:fresco:1.9.0'
        implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
        implementation 'com.squareup.picasso:picasso:2.71828'
        implementation 'com.google.android.gms:play-services-auth:15.0.1'
        implementation 'ai.api:sdk:2.0.7'
        implementation 'ai.api:libai:1.6.12'
        implementation 'com.android.support:cardview-v7:27.1.1'
        implementation 'com.android.support:design:27.1.1'
        implementation 'com.dnkilic.waveform:waveform:0.9.3'
    }
    apply plugin: 'com.google.gms.google-services'

gradle项目文件

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.3.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 个答案:

答案 0 :(得分:0)

您需要从此dependency中排除支持appcompat-v7:

implementation 'com.dnkilic.waveform:waveform:0.9.3'

用这个:

implementation ('com.dnkilic.waveform:waveform:0.9.3') {
     exclude group: 'com.android.support'
     exclude module: 'appcompat-v7'
}