android-productflavors

file:///android_res/drawable not working when using flavor with other package name

◇◆丶佛笑我妖孽 提交于 2019-11-29 06:06:45
My problem is that after I added flavors to my project the flavor with a package name different from the actual source seems to have problems with accessing the files in android_res/drawable . More specifically I have a html-view that calls the following image. <img src="file:///android_res/drawable/image.png"> The image shows up in the production flavor that has the package name which is the same as the directory of the java-files but it doesn't work for the beta flavor: productFlavors { production { packageName "com.company.myapp" } beta { packageName "com.company.beta" } } where the actual

Crashlytics (Fabric) separate organizations for application variants (build types, product flavors)

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:42:21
问题 This is self-answered question to share my knowledge. I have a project with multiple product flavors and I want to integrate Fabric using separate organizations for each product flavor. I tried to integrate Fabric using Android Studio Fabric Plugin. It adds <meta-data android:name="io.fabric.ApiKey" android:value="DEFAULT_ORGANIZATION_API_KEY" /> entry to AndroidManifest.xml of main source set. I decided to rewrite this entry in application variant specific source sets: <manifest xmlns

Localizing string resources added via build.gradle using “resValue”

不想你离开。 提交于 2019-11-28 08:27:35
This is in continuation to an answer which helped me on this post We can add the string resource as follows from build.gradle : productFlavors { main{ resValue "string", "app_name", "InTouch Messenger" } googlePlay{ resValue "string", "app_name", "InTouch Messenger: GPE Edition" } } It works like a charm and serves the purpose of having different app names per flavor. (with the original app_name string resource deleted from strings.xml file. But, how do we add localized strings for this string resource added from build.gradle ? Is there an additional parameter we can pass specifying the locale

buildConfigField depending on flavor + buildType

陌路散爱 提交于 2019-11-28 06:30:56
I'm trying to define a buildConfigVariable depending on the flavor + buildType . Ideally, this is what I want productFlavors { strawberry { buildConfigField "String", "WS_API_KEY", name + variant.buildType.name } ... more flavors .. } name does contain "strawberry", but I don't know if it's possible to access the variant 's buildType . Placed outside the Android closure I do have access to the BuildType and variant , but then I can't invoke buildConfigField android.applicationVariants.all { variant -> println "****************************" println "variant: ${variant.name}" println "flavor: $

How to apply plugin to only one flavor in gradle?

一曲冷凌霜 提交于 2019-11-28 06:13:27
I have a multi-flavored, multi-build-typed android project and I want to integrate the NewRelic plugin. But I have to apply it only for one of the customers, thus only for one product flavor. NewRelic uses instrumentation and the plugin would generate code in other flavors if I applied the plugin there, and that is not permitted for us. So my question is: How can I use the apply plugin: something command in the gradle file to be applied to only one of my flavors? Pavel Santaev Use this code: if (!getGradle().getStartParameter().getTaskRequests() .toString().contains("Develop")){ apply plugin:

How to use build types (debug vs release) to set different styles and app names?

丶灬走出姿态 提交于 2019-11-28 02:42:03
问题 Background On Android Studio, you can have different build types, each has its own configuration, similar to product-flavors (as shown here) The problem I wish that each time I have my app installed somewhere, I would immediatly know which type it was - release or debug, just by looking at it. For this, I think I can use the build.gradle file : buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable true

Product flavors in Android Studio

心已入冬 提交于 2019-11-28 02:01:18
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.release } } repositories { maven { url "https://jitpack.io" } } flavorDimensions "dim1", "dim2", "dim3" productFlavors { flavor1 { dimension "dim1" applicationId "com.example.dim1.app" } flavor3 { dimension "dim2" applicationId

Android Gradle product Flavors with Parse Push Notifications

佐手、 提交于 2019-11-28 00:53:40
问题 I am trying to send Push notifications via Parse and integrating product flavors. When I implement product flavors, i am not able to receive Parse Push Notifications. Does anyone have any advise on correcting this issue Gradle app file: apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.example.project" minSdkVersion 16 targetSdkVersion 21 } buildTypes { release { minifyEnabled false proguardFiles

file:///android_res/drawable not working when using flavor with other package name

自闭症网瘾萝莉.ら 提交于 2019-11-27 23:42:30
问题 My problem is that after I added flavors to my project the flavor with a package name different from the actual source seems to have problems with accessing the files in android_res/drawable . More specifically I have a html-view that calls the following image. <img src="file:///android_res/drawable/image.png"> The image shows up in the production flavor that has the package name which is the same as the directory of the java-files but it doesn't work for the beta flavor: productFlavors {

Multiple dex files define <my package>/BuildConfig, can't find the cause:

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 08:34:43
I'm using the new gradle build system and I'm facing the following problem: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/kibo/mobi/BuildConfig; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439