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?
For a plugin that is applied in the settings. gradle file you have three options: declare the plugin class directly in the settings. gradle file (not that useful for production but good for testing) * declare the plugin in the buildSrc project * resolve the plugin as a third party dependency.
This plugin will change the name of the APK, move the APK to your desired location, and create a text file in which it'll add all the dependencies for all the APKs you've created through the plugin. In the process, you'll learn about the following topics: Gradle tasks.
Build variants are the result of Gradle using a specific set of rules to combine settings, code, and resources configured in your build types and product flavors. Although you do not configure build variants directly, you do configure the build types and product flavors that form them.
The Base Plugin adds the base extension to the project. This allows to configure the following properties inside a dedicated DSL block. Example 2. Using the base extension. build.gradle.
Use this code:
if (!getGradle().getStartParameter().getTaskRequests() .toString().contains("Develop")){ apply plugin: 'com.google.gms.google-services' }
getGradle().getStartParameter().getTaskRequests().toString()
returns something like [DefaultTaskExecutionRequest{args=[:app:generateDevelopDebugSources],projectPath='null'}]
so as stated in the comments Develop
must start with an uppercase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With