使用Android Studio生成签名的APK

时间:2019-10-31 15:41:03

标签: android apk

当我尝试生成新的签名APK时,Android Studio中出现错误消息。错误是:“


程序类型已存在:com.google.android.gms.common.api.internal.zzd 消息{种类=错误,文本=程序类型已经存在:com.google.android.gms.common.api.internal.zzd,来源= [未知来源文件],工具名称= Optional.of(D8)}


这是我的gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "fr.xyz.application"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 46
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [
                onesignal_app_id: 'c52d60a9-812a-42d2-9157-7d2e5d777803',
                onesignal_google_project_number: 'REMOTE'
        ]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.android.support:design:26.1.0'

    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'io.reactivex:rxjava:1.2.1'
    implementation 'io.reactivex:rxandroid:1.2.1'

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'

    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'


    implementation 'com.google.firebase:firebase-auth:16.0.2'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

和我的build.gradle(project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.2'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.1, 0.99.99]'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

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

1 个答案:

答案 0 :(得分:0)

使用这些依赖项:

    implementation 'com.google.firebase:firebase-messaging:17.0.0'{
    exclude group: 'com.google.android.gms'
}
    implementation 'com.google.firebase:firebase-core:16.0.1'{
    exclude group: 'com.google.android.gms'
}
    implementation 'com.google.firebase:firebase-auth:16.0.2'{
    exclude group: 'com.google.android.gms'
}
implementation('com.facebook.android:facebook-android-sdk:4.x') {
    exclude group: 'com.google.android.gms'
}