Questions tagged [android-sourcesets]

17 questions
25
votes
0 answers

Copy constructor using "initWith" for "productFlavors" and "sourceSets"

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…
12
votes
1 answer

The SourceSet 'commonTest' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?

Seemingly the same root cause as this question, but the answer there will not work for me. I have a custom source set called commonTest that I use for sharing certain test utility code across the test and androidTest source sets. Here is my relevant…
6
votes
2 answers

Dynamically generating productFlavors and sourceSets using a list of names (with properties) in a CSV/TXT file

This question in continuation of my other question, which i want to improve further. I am being able to group flavors (having common configuration) under sourceSets with the following code : (got it from a genius in the linked question above) import…
5
votes
2 answers

Databinding class not generated for multiple layout folders

In Android studio 3.6, after creating new project, I am not able to created binding generated class for multiple folders. I have multiple layout folders: res/layout res/layouts/dashboard res/layouts/notifications I am able to created binding class…
5
votes
3 answers

Grouping few of many sourceSets having exactly same configuration

Lets say I have the following sourceSets: sourceSets { flavor1 { assets.srcDirs = ['repo-assets/flavor1'] res.srcDirs = ['repo-res/flavor1'] } flavor2 { assets.srcDirs = ['repo-assets/flavor2'] res.srcDirs…
4
votes
2 answers

Run unit test for main and specific flavours android

I have 5 Flavors mapped to 2 source folders with some common code written in main folder, The b folder has some extra beans for which I have written unit test, now I want to run unit test like all the unit tests in main folders run with some…
3
votes
0 answers

How can I add directories to a Gradle sourceset by wildcard pattern?

I would like to separate various source types into per-module areas without either: adding a separate Android module project (or build.gradle) for each or explicitly adding each module's source directories to appropriate source sets in build So…
user6519354
  • 169
  • 1
  • 7
2
votes
2 answers

What is the location of android.databinding.Observable?

Android Studio 3.0.1 is complaining that it can't find this class. Even though it builds, it just shows an awful red underline. That's my first question, but also curious where IS this elusive class? Looking in the expanded libraries it doesn't show…
Erik B
  • 2,810
  • 1
  • 34
  • 38
2
votes
1 answer

Flavor Dimension source code

I have a project with about 30 product flavors. Some of these product flavors need to share code, without sharing it with most product flavors. Can I assign code to a flavor group?
2
votes
1 answer

product flavors, sources sets.Excluding files - android studio

I have an app with 4 product flavors. The build.gradle looks like this: android { compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.example.testing" minSdkVersion 23 targetSdkVersion 23 …
1
vote
0 answers

Declaring res.srcDirs breaks Android Studio change detection of resource files

We have multiple build variants in our Android client. We just started sharing source code and resources across build variants via custom source sets. This is what they look like: sourceSets { internalDevelopment { …
Steve
  • 538
  • 4
  • 17
1
vote
1 answer

How to separate source files per test type in an Android library project?

I was following the gradle docs to separate source files per test type in a Java project and I wanted to do the same thing in an Android library project. By default Android plugin com.android.library supports two types of test directories test and…
Prudhvi
  • 2,276
  • 7
  • 34
  • 54
0
votes
0 answers

Adding .so files by wildcard search to an android library project using gradle 7.4+

I am trying to add .so files by wildcard search to my android library project. In my library structure I have 2 sub-projects with build.gradle files called primary and testapp. The project primary generates some libraries in the form testLib_*.so.…
0
votes
1 answer

How can I use specific classes when building an apk with Android Studio?

I searched a little about this here but didn't found anything that helps me, maybe because it's impossible but I need confirmation. The situation is the following: I have an android app that integrate with many mobile POS, these card machines, and…
0
votes
1 answer

Android: Are there any methods to share a resource betwwen different falvors and sourceset?

I have an application with below source sets and flavors: flavorDimensions "brand" productFlavors { flavor1 { dimension "brand" sourceSets { main { manifest.srcFile "src/main/flavor1/AndroidManifest.xml" …
VSB
  • 9,825
  • 16
  • 72
  • 145
1
2