android-productflavors

How to use flavors with different app names in Android studio?

*爱你&永不变心* 提交于 2019-12-18 10:48:13
问题 In my app-level build.gradle I have the following flavors: productFlavors { originalFlavour{ } freeFlavour{ } } The thing is building both flavors I get the same App Name. Instead I would like to have different app names for each flavors. Just adding a suffix would be useful. Hope someone could help me. Thanks in advance EDIT : app/src/main/AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="z.fncapps

Product flavors in Android Studio [duplicate]

拟墨画扇 提交于 2019-12-17 16:59:33
问题 This question already has answers here : Reference different assets based on build flavor (2 answers) Closed 4 months ago . I can not get product flavours working. I have this gradle apply plugin: 'com.android.application' android { defaultConfig { minSdkVersion 14 targetSdkVersion 24 compileSdkVersion 27 } signingConfigs { release { } } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' signingConfig signingConfigs

Force locale for Android flavor with resConfig

余生长醉 提交于 2019-12-17 10:39:12
问题 I am trying to use the resConfig and resConfigs from the Android Build system. Android Studio version 1.2.2 Gradle build version 1.2.3 OSX 10.10.3 I was having problem with these 2 options with my project so I started a new blank project with android studio. I attached my build.gradle where I only added resConfigs "en", "fr" under android { defaultConfig { ... resConfigs "en", "fr" ... } } And defined 2 basic flavors productFlavors { fr { resConfig "fr" } en { resConfig "en" } } I then

Product flavors and source hierarchies

时光怂恿深爱的人放手 提交于 2019-12-13 22:18:48
问题 My app has two flavors, call it flavora and flavorb for simplicity. productFlavors { flavora { resValue "string", 'app_name', "App Name Flavor A" applicationIdSuffix ".flavora" } flavorb { resValue "string", 'app_name', "App Name Flavor B" applicationIdSuffix ".flavorb" } } I want both flavors to use all the same layouts, all the same java code, all the same resources, etc, EXCEPT I want flavora and flavorb to use different implementations for layout file flavor_dependent_layout.xml and Java

BuildConfig prop for each buildType / productFlavor combination

北城以北 提交于 2019-12-12 17:20:31
问题 I have free and paid versions of an app. I need to configure with gradle a prop on BuildConfig that is different for each buildType / productFlavor combination. free-debug -> prop1=value1 free-release -> prop1=value2 paid-debug -> prop1=value3 paid-release -> prop1=value4 My build types are debug / release, and my product flavors are free / paid Could you help me with this? 来源: https://stackoverflow.com/questions/27405301/buildconfig-prop-for-each-buildtype-productflavor-combination

How can I use different proguard files in different flavors or for different build types?

荒凉一梦 提交于 2019-12-12 11:23:29
问题 I need to make different flavors for test libraries. Why? Well, I want project to be fully secured so I wanna minifying to be enabled all the time(even for debug build type). While making tests I'm using different classes from project, so I decided to change proguard files using flavor. It looks like something this : android { ... buildTypes { release { minifyEnabled true testProguardFile 'test-proguard-rules.pro' } debug { minifyEnabled true testProguardFile 'test-proguard-rules.pro' } } ...

Android: Application for different requirements and features

ぐ巨炮叔叔 提交于 2019-12-12 04:37:14
问题 Using build variant in Android we can support different flavors. I need to develop an application where I am supporting different clients. Each client needs are a little different. However, the basic data, network call class etc are same for all clients. How can I ensure partial code of my application remains same for all flavors? This will help in maintaining one repository for all common classes. 回答1: You need to understand how build variant works. Each client needs are a little different

Android Flavor Intent Activity

纵然是瞬间 提交于 2019-12-11 07:14:30
问题 How to create an intent to an activity depending on the flavor? Hierarchy: main -ActivityA flavor(free) -uses main/ActivityA flavor(paid) -uses own paid/ActivityA So how to create a Intent depending on the current flavor? 回答1: You can get Activity class by it's name. This way you won't get compile errors: Intent i = new Intent(this, Class.forName("com.xxx.packagename.paid.ActivityA")) 回答2: You can do a lot with flavors, but what you are trying to do is far simpler than anyone has answered.

Android multi flavor library referenced from non flavor application - AAPT: No resource found

北慕城南 提交于 2019-12-10 09:46:33
问题 I have library which contains string resource: <string name="lib_name">MyLibrary</string> Reference to library in application build.gradle: dependencies{ compile project(':mylibrary') ... } In application module I have displayed this text resource: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lib_name" /> There is no problem without using flavors. Now I want to add new flavor to library with different text. build.gradle of library:

Copy constructor using “initWith” for “productFlavors” and “sourceSets”

核能气质少年 提交于 2019-12-10 01:48:02
问题 With reference to this answer. Is it possible to create a copy constructor for productFlavors and sourceSets using initWith just like the one in the linked answer. That one worked great for buildTypes . For buildTypes it was done this way: debugfree.initWith(buildTypes.debug) Is this possible for productFlavors and sourceSets as well? 来源: https://stackoverflow.com/questions/36199741/copy-constructor-using-initwith-for-productflavors-and-sourcesets