android-productflavors

buildConfigField depending on flavor + buildType

夙愿已清 提交于 2019-12-28 11:54:28
问题 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 {

How to solve NullPointerException void com.google.android.gms.ads.AdView.loadAd(com.google.android.gms.ads.AdRequest) with Butterknife

房东的猫 提交于 2019-12-25 07:14:42
问题 Actually, I am trying to make an app with free and paid flavors. When I use simple findViewById method to bind then it works fine. But when I trying to add butterKnife, I desperately stuck with butterKnife. I am trying to bind content (such as AdMob OR Button) by butterknife bind in MainActivity.java file. but it shows Nullpointer exception error first it shows on AdMob object nullpointer exception. I run clean project then it shows on button.onClickListener Nullpointer exception. Please help

“Application not installed on your phone” when accessing activity using product flavors. Any Advice?

喜你入骨 提交于 2019-12-24 19:19:15
问题 My gradle has: defaultConfig { targetSdkVersion 26 applicationId 'com.company.appname' } buildTypes { debug { minifyEnabled false useProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', 'proguard-ulivewallpaper.txt' jniDebuggable true } release { minifyEnabled false useProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', 'proguard-ulivewallpaper.txt' signingConfig signingConfigs.debug } }

Cannot build app with Gradle with flavors and com.google.gms.google-services plugin

99封情书 提交于 2019-12-24 10:50:05
问题 When i try to compile my app with flavors based on minSdk i receive an error: Error:Execution failed for task ':app:processCurrentDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.2.0. I pasted example from Android Developers Blog and it's not

Gradle dynamic flavor

你。 提交于 2019-12-24 03:19:08
问题 I would like to create dynamic flavors from the directory tree It works great! But android-studio use gradle in his tmp file like: /home/svirch_n/.IntelliJIdea14/system/compile-server and my script doesn't work anymore because it uses relative paths Like this: Closure getFlavors = { rootDir, basePackage -> def result = [:] new File("$rootDir").eachDir() { dir -> def name = dir.getName() if ("$name" != "main") result.put("$name", "$basePackage.$name") } return result } // This is a ugly

Gradle-only solution to modify App name based on Build Variant

核能气质少年 提交于 2019-12-23 09:50:29
问题 I am trying to modify my gradle file to allow for different names for my app based on Flavor and Build Type . So far, I have been successful in being concise with Flavor based naming using Manifest Merging techniques via the Android Gradle Plugin Docs Current These are the names of the applications on my home screen for both my debug and release builds. Flavor Debug App Name Release App Name -------- -------------- ---------------- entity_1 App Name App Name entity_2 App Name App Name ... ...

Android Studio: How to exclude google-services module in product flavor?

社会主义新天地 提交于 2019-12-23 07:38:47
问题 In my Android project, there are several product flavors: buildTypes { release {} debug {} staging {} } productFlavors { freeVersion {} proVersion {} partnerVersion {} } Also, i use Google Analytics: apply plugin: 'com.google.gms.google-services' dependencies { compile 'com.google.android.gms:play-services-analytics:8.4.0' } How to exclude google-services in one of them? For example, in: freeVersion {} 回答1: Please notice the use of freeCompile and declaring a variable flavor to conditionally

INSTALL_FAILED_CONFLICTING_PROVIDER with Facebook SDK when I build multiple productFlavors

时光总嘲笑我的痴心妄想 提交于 2019-12-21 12:16:00
问题 I'm building an Android app with multiple productFlavors , and using Facebook SDK v4.1 for login and sharing contents. The problem is that when I try to install an app on a device which already has the same app installed (but different flavor), it raises an error. It doesn't allow me to install the second app unless I uninstall the existing one. <provider android:authorities="com.facebook.app.FacebookContentProvider{my_app_id}" android:name="com.facebook.FacebookContentProvider" android

Test package for different flavors in Android Studio

南楼画角 提交于 2019-12-21 03:33:21
问题 I am experimenting flavors on an application in androidstudio. I have to write different test classes for the flavors, as I have different class files for the flavors. But I wonder if there is any option to specify test packages for each flavor in build.gradle. Here is my build.gradle for reference. I use 0.4.6 version of AndroidStudio. apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 19 testPackageName "com

Single flavor module based on multi flavor library in Gradle

≯℡__Kan透↙ 提交于 2019-12-19 13:50:29
问题 I'm working on a multi-flavor app . (gradle files below) It uses a library called tracker that follow the same flavors internal and external Now for the tricky part, come a new module called feature , this one has no flavor but it needs the tracker as dependency app.gradle: android { buildTypes { debug { } release { } } flavorDimensions "target" productFlavors { internal { dimension "target" } external { dimension "target" } } } tracker.gradle: android { publishNonDefault true buildTypes {