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

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

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

問題描述

我的應用針對多個市場的應用內計費系統具有多種風格.

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

問題是android庫可以有產品風味嗎?

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

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

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.

這篇關于基于 Android Gradle 中多風味庫的多風味應用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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;在“清單中找到錯誤?)
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 項目時得到重復的類)
主站蜘蛛池模板: 日本久久久久久 | 欧美激情国产精品 | 激情播播网 | 538在线视频 | 欧美777| 免费看黄色av | 久久精品视频网 | 精品一区二区三区四区 | 91国产视频在线观看 | 欧美三级 欧美一级 | 国产成人一区二区 | 黄色成人免费视频 | 黄网免费看 | 成人特级毛片 | 日韩精品在线看 | 欧美一区二区三区在线观看 | 欧美日日日 | 97久久精品人人澡人人爽 | 国产精品久久一区 | 青青草久草 | 欧美三级在线视频 | 香蕉伊人网 | 日本一级片在线观看 | 少妇高潮久久久久久潘金莲 | 亚洲精品一级 | 久久久精品免费 | 国产一区二区在线播放 | 欧美精品成人 | 日本不卡在线视频 | 成年人黄色大片 | 国产精品一区二区在线播放 | 欧美日韩黄色片 | 欧美日韩免费视频 | 在线国产小视频 | 国产一区二区网站 | 免费看91| 伊人久久综合 | 国产色视频一区二区三区qq号 | 高h乱l高辣h文短篇h | 日韩精品在线免费观看 | 欧美一区二区三区在线视频 |