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

基于 Android Gradle 中多風味庫的多風味應用

Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
本文介紹了基于 Android Gradle 中多風味庫的多風味應用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我的應用針對多個市場的應用內(nèi)計費系統(tǒng)具有多種風格.

我有一個共享我所有項目的基本代碼的庫.所以我決定將這些支付系統(tǒng)作為產(chǎn)品風味添加到這個庫中.

問題是android庫可以有產(chǎn)品風味嗎?

如果是這樣,我如何在應用的各個風味中包含不同的風味?

我搜索了很多,但我找不到關(guān)于這個場景的任何信息.我發(fā)現(xiàn)的唯一接近的東西是

My app has several flavors for several markets in-app-billing systems.

I have a single library which shares the base code for all of my projects. So I decided to add those payment systems to this library as product flavors.

The question is can android library have product flavors?

If so, how can I include different flavors in respective flavor of the app?

I searched a lot, and I couldn't find anything about this scenario. The only close thing I found was this in http://tools.android.com/tech-docs/new-build-system/user-guide:

dependencies {
    flavor1Compile project(path: ':lib1', configuration: 'flavor1Release')
    flavor2Compile project(path: ':lib1', configuration: 'flavor2Release')
}

I changed configuration to different things but it did not work!

I'm using android studio 0.8.2.

解決方案

Finally I found out how to do this, I will explain it here for others facing same problem:

The key part is to set publishNonDefault to true in library build.gradle, Then you must define dependencies as suggested by user guide.

The whole project would be like this:

Library build.gradle:

apply plugin: 'com.android.library'

android {        
    ....
    publishNonDefault true
    productFlavors {
        market1 {}
        market2 {}
    }
}

project build.gradle:

apply plugin: 'com.android.application'

android {
    ....
    productFlavors {
        market1 {}
        market2 {}
    }
}

dependencies {
    ....
    market1Compile project(path: ':lib', configuration: 'market1Release')
    market2Compile project(path: ':lib', configuration: 'market2Release')
}

Now you can select the app flavor and Build Variants panel and the library will be selected accordingly and all build and run will be done based on the selected flavor.

If you have multiple app module based on the library Android Studio will complain about Variant selection conflict, It's ok, just ignore it.

這篇關(guān)于基于 Android Gradle 中多風味庫的多風味應用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) 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;在“清單中找到錯誤?)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
Why I#39;m Getting Duplicate Class When Running My Android Project(為什么我在運行我的 Android 項目時得到重復的類)
主站蜘蛛池模板: 欧美成人一区二区三区 | 特级黄色毛片 | 国产免费a视频 | 中文字幕一区二区视频 | 亚洲色图网址 | 日本久久久久久 | 日韩福利| 自拍视频网站 | 国产在线视频一区二区 | 国产精品99久久久久久久vr | 超碰日韩 | 欧美一级黄色免费看 | 999久久久国产精品 欧美成人h版在线观看 | 亚洲毛片在线观看 | 爱爱免费视频 | 中文字幕一区二区三区四区 | 欧美日韩1区| 亚洲日韩中文字幕一区 | 国产成人久久精品 | 国产免费观看一级国产 | 亚洲欧洲日本国产 | 色综合久久久久 | 久久精品成人热国产成 | 午夜免费 | 中文字幕在线免费观看 | 国产精品1区 | 午夜一区二区三区在线观看 | 最新中文字幕久久 | 亚洲国产精品一区二区久久 | 亚洲精品一区二区在线观看 | 国产夜恋视频在线观看 | 免费一级黄色电影 | 伊人一区 | 亚洲精品久久久一区二区三区 | 亚洲成人免费网址 | 国产 欧美 日韩 一区 | 色视频一区二区 | 色综合一区二区 | 亚洲精品2 | 亚洲第一天堂无码专区 | 久久精品国产v日韩v亚洲 |