android-productflavors

ClassNotFoundException in custom flavor using kotlin

元气小坏坏 提交于 2019-12-08 21:55:31
问题 I defined my own flavor and set sourceSet: sourceSets { main.java.srcDirs += 'src/main/kotlin' // WORKS myflavor.java.srcDirs += 'src/myflavor/kotlin' // DOESN'T WORK } here is my project structure: but... I receive following error: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{xyz/xyz.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "xyz.MainActivity" on path: DexPathList[[zip file "/data/app/xyz/base.apk"],nativeLibraryDirectories=[/vendor/lib,

Gradle SourceSets by productFlavor and buildType

亡梦爱人 提交于 2019-12-07 18:58:45
问题 EDIT flavors and paths: Currently I have: sourceSets.whenObjectAdded { sourceSet -> def sourceData = rootProject.ext[sourceSet.name] sourceSet.java.srcDirs = sourceData.javaDirRelease } The rootProject.ext is a file where all the productFlavor specific configuration is defined like this: ext{ flavor1 = [ javaDirRelease : ['src/pathToJavaReleaseFiles'] javaDirDebug : ['src/pathToJavaDebugFiles'] ] } In the main build.gradle I also do: apply from: 'variants.gradle' which contains the above ext{

How to Modify Code Between Product Flavors

我怕爱的太早我们不能终老 提交于 2019-12-07 16:15:10
问题 I'm creating a very simple app with a free and paid version, for this I'm using the great productFlavors feature in the Android Gradle plugin. I understand how the build.gradle file should be configured and have written it so my build options are; freeRelease freeDebug paidRelease PaidDebug that looks as follows buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.someconfig } } productFlavors

Android flavor - cannot find symbol variable in R file

我是研究僧i 提交于 2019-12-06 23:45:47
问题 I have 2 flavors - paidapp and freeapp. The only difference that paidapp have 1 more button on MainActivity , say "paidbutton" . paidapp has its own layout with button android:id="@+id/paidbutton" and layout for freeapp does not have this button. In code I use this: if (BuildConfig.FLAVOR.equals("paidapp")) { View paidbutton = findViewById(R.id.paidbutton); paidbutton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //... } }); } But I have an error cannot

Gradle SourceSets by productFlavor and buildType

大城市里の小女人 提交于 2019-12-06 08:46:58
EDIT flavors and paths: Currently I have: sourceSets.whenObjectAdded { sourceSet -> def sourceData = rootProject.ext[sourceSet.name] sourceSet.java.srcDirs = sourceData.javaDirRelease } The rootProject.ext is a file where all the productFlavor specific configuration is defined like this: ext{ flavor1 = [ javaDirRelease : ['src/pathToJavaReleaseFiles'] javaDirDebug : ['src/pathToJavaDebugFiles'] ] } In the main build.gradle I also do: apply from: 'variants.gradle' which contains the above ext{} object. The sourceSets are defined as such: sourceSets { flavor1{} } This works but I want to do add

Android Gradle: Install all build types on one device

女生的网名这么多〃 提交于 2019-12-06 05:37:16
问题 How do I configure my project to be able to install the debug version alongside the release version when using GCM, ContentProvider, AccountType? (without the use of flavors) I keep getting errors such as: INSTALL_FAILED_CONFLICTING_PROVIDER or INSTALL_FAILED_DUPLICATE_PERMISSION 回答1: Installing a debug apk and the release apk on the same device is tricky if you are only using build types and not flavors (Why Build types and not flavors) Most blog post are either outdated (talking about

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

和自甴很熟 提交于 2019-12-06 00:15:14
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: android { ... productFlavors { myFlavor {} } } Then I create new resource file for new flavor \mylibrary

How to Modify Code Between Product Flavors

爷,独闯天下 提交于 2019-12-05 19:44:04
I'm creating a very simple app with a free and paid version, for this I'm using the great productFlavors feature in the Android Gradle plugin. I understand how the build.gradle file should be configured and have written it so my build options are; freeRelease freeDebug paidRelease PaidDebug that looks as follows buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.someconfig } } productFlavors { free { packageName "com.somepackagename.appfree" } paid { packageName "com.somepackagename.appPaid" }

Android Gradle: Install all build types on one device

旧时模样 提交于 2019-12-04 12:07:20
How do I configure my project to be able to install the debug version alongside the release version when using GCM, ContentProvider, AccountType? (without the use of flavors) I keep getting errors such as: INSTALL_FAILED_CONFLICTING_PROVIDER or INSTALL_FAILED_DUPLICATE_PERMISSION Benoit Installing a debug apk and the release apk on the same device is tricky if you are only using build types and not flavors ( Why Build types and not flavors ) Most blog post are either outdated (talking about packageName) or force you to use flavors because the solution they propose does not support

Robotium - testing specific flavors in Android Studio with Gradle

≡放荡痞女 提交于 2019-12-04 06:26:56
问题 So... i'm trying to make some tests for my application. I have several flavors in my application, and I want to build individual tests for each flavor. From the Robotium documentation I used the "androidTest/java" folder with a package inside... I event tried after some suggestions to input a flavor's .test. Another suggestion from here: http://tools.android.com/tech-docs/new-build-system/user-guide was to make several folders named "androidTest", but it didn't worked. I have the latest