久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

多個變體的多個簽名配置

Multiple signingConfigs for multiple variants(多個變體的多個簽名配置)
本文介紹了多個變體的多個簽名配置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何為不同的變體設置不同的簽名配置?

How can I set different signing configs for different variants?

例如,我們目前有 Debug/Beta/Release 兩種構建類型,免費和付費,產生 6 個變體.為了讓它更容易一點,讓我們忘記 Debug 變體,只關注 freeBeta/paidBeta/freeRelease/paidRelease.

For instance, we currently have the buildtypes Debug/Beta/Release with 2 flavors, free and paid, resulting in 6 variants. To make it a bit easier, let's forget the Debug variants and only focus on freeBeta/paidBeta/freeRelease/paidRelease.

我想要的是,每個變體使用單獨的不同簽名配置.

What I'd like, is for each variant to use a separate different signingConfig.

到目前為止,我能找到的唯一解決方案是將signingConfigs 放在buildTypes 中,這樣所有Beta 變體都將具有相同的signingConfigs:

So far the only solutions I could find is either putting the signingConfigs in the buildTypes so all Beta variants would have the same signingConfigs:

buildTypes {
    beta {
        signingConfigs.beta
    }
    release {
        signingConfigs.release
    }
}

或者,使用風味,在這種情況下,所有免費變體都將具有相同的簽名配置:

Alternatively, using the flavors, in which case all free variants would have the same signingConfigs:

productFlavors {
    free {
        signingConfig signingConfigs.free
        applicationId 'com.example.free'
    }
    paid {
        signingConfig signingConfigs.paid
        applicationId 'com.example.paid'
    }
}

在當前的 productFlavor 閉包中有沒有辦法做到這一點?這只能通過覆蓋 android.applicationVariants.all { variant -> 并根據某種命名方案或其他一些丑陋的 hack 為每個應用程序變體手動應用signingConfig 來解決嗎?

Is there a way to do this in the current productFlavor closure? Can this only be fixed by overridding the android.applicationVariants.all { variant -> and manually applying a signingConfig for each application variant based on some naming scheme or some other ugly hack?

我也找到了這個答案,但是它似乎不適用于最新的構建工具;編譯時出現以下錯誤:

I also found this answer, but it doesn't appear to work in the latest build tools; when compiling I get the following error:

FAILURE:構建失敗并出現異常.

FAILURE: Build failed with an exception.

  • 其中:構建文件 '/home/dev/projects/app/build.gradle' 行:61

  • Where: Build file '/home/dev/projects/app/build.gradle' line: 61

出了什么問題:評估項目 ':app' 時出現問題.

What went wrong: A problem occurred evaluating project ':app'.

在 ProductFlavor 容器上找不到免費"屬性.

Could not find property 'free' on ProductFlavor container.

推薦答案

https://stackoverflow.com/a/32810290/3961802 答案不起作用.

    beta {
        productFlavors.free.signingConfig signingConfigs.freeBeta
        productFlavors.paid.signingConfig signingConfigs.paidBeta
    }
    release {
        productFlavors.free.signingConfig signingConfigs.freeRelease
        productFlavors.paid.signingConfig signingConfigs.paidRelease                
    }

在這種情況下,發布版本類型將覆蓋所有風格.所以 freeBeta 的簽名配置將是 freeRelease.

In this case, the release build type will overwrite all flavors. So signing config for the freeBeta will be freeRelease.

目前,我知道的唯一解決方案是在單獨的任務中簽署所有構建變體.

At the moment, the only solution that I know is to sign all the build variants in a separate task.

signingConfigs {

    bananaDebug {}
    bananaBeta {}
    bananaRelease {}

    orangeDebug {}
    orangeBeta {}
    orangeRelease {}

    lemonDebug {}
    lemonBeta {}
    lemonRelease {}
}

productFlavors {

    banana {}

    orange {}

    lemon {}
}

buildTypes {

    debug {}

    beta {}

    release {}
}

applicationVariants.all {
    def flavorName = it.getFlavorName()
    def buildTypeName = it.buildType.name
    def buildVariantName = flavorName + buildTypeName.capitalize()
    def currentSigningConfig = signingConfigs.getByName(buildVariantName)

    it.mergedFlavor.signingConfig = currentSigningConfig
    // If you want to sign debug build
    buildTypes.debug.signingConfig currentSigningConfig
}

這篇關于多個變體的多個簽名配置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 一区二区三区国产好的精 | 亚洲精品综合 | 九九在线视频 | 国产主播第一页 | 日日摸夜夜添夜夜添精品视频 | 免费观看日韩精品 | 国产精品免费视频一区 | 一区二区三区在线免费观看视频 | 精品国产91亚洲一区二区三区www | 国产欧美日韩综合精品一 | 欧美高清dvd| 91天堂网 | 日韩欧美一区在线 | 91中文字幕在线观看 | 伊人超碰| av手机免费在线观看 | 日本久久网站 | 偷拍自拍网址 | 久草视频网站 | 天堂中文在线观看 | 99精品网站 | 中国黄色在线视频 | 国产精品国产成人国产三级 | 天天综合久久 | 国产精品久久久久久久久久久免费看 | 久久精品91久久久久久再现 | 人人鲁人人莫人人爱精品 | www.国产精| 久久精品综合 | 久久久青草婷婷精品综合日韩 | 国产成人午夜高潮毛片 | 日本超碰 | 999久久久 | 久久久久久国产精品久久 | 亚洲色在线视频 | 盗摄精品av一区二区三区 | 国产不卡在线 | 日韩免费中文字幕 | 久久久女女女女999久久 | 久草福利 | 欧美一级久久久猛烈a大片 日韩av免费在线观看 |