簡體   English   中英

使用 android studio 生成簽名的 apk

[英]Generating signed apk with android studio

當我嘗試生成新的簽名 apk 時,Android Studio 中出現錯誤消息。 錯誤是:“


Program type already present: com.google.android.gms.common.api.internal.zzd Message{kind=ERROR, text=Program type already present: com.google.android.gms.common.api.internal.zzd, sources =[未知源文件],工具名=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
}

使用這些依賴項:

    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'
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM