生成APK时出错,错误“程序类型已存在:android.support.v7.widget.DefaultItemAnimator $ 1”

时间:2018-04-24 14:04:18

标签: android gradle

错误记录

程序类型已存在:android.support.v7.widget.DefaultItemAnimator $ 1 消息{kind = ERROR,text =程序类型已存在:android.support.v7.widget.DefaultItemAnimator $ 1,sources = [未知源文件],工具名称= Optional.of(D8)}

  

将迁移的gradle从1.5.0迁移到3.1.0并编译后出现此错误   sdk版本23到26.该应用程序在调试模式下在设备上构建和运行   正确,但当我尝试构建apk或生成签名的apk时,   以上错误来了。我使用的是android 3.1.1。

摇篮
app level gradle

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
    } }

allprojects {
    repositories {
        mavenCentral()
        google()
        jcenter()
    } }

'./utils/global.gradle'

模块级移动平台

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    google()
}


android {

    // Always target latest version
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    flavorDimensions '18032613'

    useLibrary 'org.apache.http.legacy'

    signingConfigs {
        example {
            keyAlias 'example'
            keyPassword 'test'
            storeFile file('../signing/keystore')
            storePassword 'test'
        }
    }

    defaultConfig {

        applicationId 'com.example.com'
        minSdkVersion 19
        targetSdkVersion 26
        //versionCode getDate().toInteger()
        versionCode 18032613
        versionName "1.4.28"
        signingConfig signingConfigs.example
        multiDexEnabled true

    }

    buildTypes {

        release {

            debuggable false
            minifyEnabled false
            shrinkResources false

        }

        debug {

            debuggable false
            //versionNameSuffix ".${getDate()}-debug"
            versionNameSuffix ".${18032613}-debug"
            applicationIdSuffix '.debug'
            minifyEnabled false
            shrinkResources false
            resValue "integer", '__leak_canary_max_stored_leaks', '50'

        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    dexOptions {
        //incremental true
        javaMaxHeapSize "12g"
    }
    //To solve error "Lint found fatal errors while assembling a release target."
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

dependencies {

    // JARs from lib directory
    implementation fileTree(dir: 'libs', include: '*.jar')

    // Project Lombok
    compileOnly 'org.projectlombok:lombok:1.16.20'
    annotationProcessor "org.projectlombok:lombok:1.16.20"
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    //debugCompile project(path: ':utilsLibrary', configuration: "${android.defaultConfig.applicationId}Debug")
    //releaseCompile project(path: ':utilsLibrary', configuration: "${android.defaultConfig.applicationId}Release")

    implementation project(':utilsLibrary')

    wearApp project(':keycutWearable')

    implementation('com.facebook.android:facebook-android-sdk:4.6.0') {
        exclude module: 'support-v4'
    }


    implementation 'com.google.android.gms:play-services-wearable:12.0.1'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:support-annotations:26.1.0'
    implementation 'com.google.android.gms:play-services-gcm:12.0.1'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.code.gson:gson:2.2.4'
    implementation 'org.hibernate:hibernate-validator:5.1.3.Final'
    implementation 'javax.el:javax.el-api:2.2.4'
    implementation 'org.glassfish.web:javax.el:2.2.4'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.github.bumptech.glide:glide:3.5.2'

    //compile 'com.uber.sdk:rides-android:0.3.1'

    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
}

模块级可穿戴式gradle

apply plugin: 'com.android.application'

android {

    // Always target latest version
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    flavorDimensions '18032613'

    signingConfigs {
        example {
            keyAlias 'example'
            keyPassword 'test'
            storeFile file('../signing/keystore')
            storePassword 'test'
        }
    }

    defaultConfig {

        applicationId "com.example.com"
        minSdkVersion 20
        targetSdkVersion 26
        //versionCode getDate().toInteger()
        versionCode 18032613
        versionName "1.2"
        signingConfig signingConfigs.keycut

    }


    buildTypes {

        release {

            debuggable false
            minifyEnabled false
            shrinkResources false

        }

        debug {

            debuggable false
            //versionNameSuffix ".${getDate()}-debug"
            versionNameSuffix ".${18032613}-debug"
            applicationIdSuffix '.debug'
            minifyEnabled false
            shrinkResources false

        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

dependencies {

    // Project Lombok
    compileOnly 'org.projectlombok:lombok:1.16.20'
    annotationProcessor "org.projectlombok:lombok:1.16.20"
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    // Wearable Service
    implementation ('com.google.android.support:wearable:1.0.0'){
        exclude module: 'support-v4'
    }
    compileOnly 'com.google.android.wearable:wearable:1.0.0'
    implementation ('com.google.android.gms:play-services-wearable:8.3.0'){
        exclude module: 'support-v4'
    }

    // Utils Library
    //debugCompile project(path: ':utilsLibrary', configuration: "${android.defaultConfig.applicationId}Debug")
    //releaseCompile project(path: ':utilsLibrary', configuration: "${android.defaultConfig.applicationId}Release")

    implementation project(':utilsLibrary')

}

模块级别gradle

apply plugin: 'com.android.library'

android {

    // Always target latest version
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    flavorDimensions '18032613'

    defaultPublishConfig 'release'
    publishNonDefault true

    // Generate version code from date
    defaultConfig {

        minSdkVersion 19
        targetSdkVersion 26
        //versionCode getDate().toInteger()
        versionCode 18032613
        //buildConfigField 'String', 'ADMOB_BANNER_ID', '"BANNERID"'
        //buildConfigField 'String', 'ADMOB_INTERSTITIAL_ID', '"INTERSTITIALID"'
        buildConfigField 'String', 'ADMOB_BANNER_ID', '"ca-app-pub-55663938299199712/4792255984"'      //orginal
        buildConfigField 'String', 'ADMOB_INTERSTITIAL_ID', '"ca-app-pub-55663938299199712/6596667788"'    //orginal

        //buildConfigField 'String', 'ADMOB_BANNER_ID', '""'
        //buildConfigField 'String', 'ADMOB_INTERSTITIAL_ID', '""'

        //buildConfigField 'String', 'SUPPORT_URL', '"http://example.support.url"'
        //buildConfigField 'String', 'COMPANY_NAME', '"Your Company Name"'
        buildConfigField 'String', 'SUPPORT_URL', '"http://www.company.in/"'
        buildConfigField 'String', 'COMPANY_NAME', '"Company"'

        multiDexEnabled true

    }

    buildTypes {

        release {

            debuggable false
            minifyEnabled false
            shrinkResources false

        }

        debug {

            debuggable false

            //versionNameSuffix ".${getDate()}-debug"
            versionNameSuffix ".${18032613}-debug"
            minifyEnabled false
            shrinkResources false

        }

    }

    productFlavors {

        'com.example.com' {

            manifestPlaceholders = [ appPackageName: 'com.example.com' ]
            buildConfigField 'String', 'APP_PACKAGE_NAME', '"com.example.com"'
            buildConfigField 'String', 'APP_DISPLAY_NAME', '"example"'


        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

dependencies {

    // Project Lombok
    compileOnly 'org.projectlombok:lombok:1.16.20'
    annotationProcessor "org.projectlombok:lombok:1.16.20"
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    implementation 'com.google.android.gms:play-services-ads:8.3.0'

    // Find bugs
    implementation 'com.google.code.findbugs:jsr305:2.0.2'

    // Javax Annotations
    implementation 'javax.annotation:jsr250-api:1.0'

    implementation 'com.android.support:design:26.1.0'
    api 'com.squareup:otto:1.3.6'


    implementation 'com.android.support:multidex:1.0.2'


}

任何人都可以帮我解决错误!

0 个答案:

没有答案