Firebase Performance Plugin causing slow build time
When using Firebase Performance in Android Studio the gradle task app:transformClassesWithFirebasePerformancePluginForDebug is taking significantly longer than any other task and is therefore dramatically slowing down my gradle build times.
Slow Build shown in Profiler
java
add a comment |
When using Firebase Performance in Android Studio the gradle task app:transformClassesWithFirebasePerformancePluginForDebug is taking significantly longer than any other task and is therefore dramatically slowing down my gradle build times.
Slow Build shown in Profiler
java
1
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02
add a comment |
When using Firebase Performance in Android Studio the gradle task app:transformClassesWithFirebasePerformancePluginForDebug is taking significantly longer than any other task and is therefore dramatically slowing down my gradle build times.
Slow Build shown in Profiler
java
When using Firebase Performance in Android Studio the gradle task app:transformClassesWithFirebasePerformancePluginForDebug is taking significantly longer than any other task and is therefore dramatically slowing down my gradle build times.
Slow Build shown in Profiler
java
java
edited Nov 19 '17 at 20:58
Rahul Shah
1,04731537
1,04731537
asked Nov 19 '17 at 18:35
Ian WhiteIan White
938
938
1
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02
add a comment |
1
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02
1
1
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02
add a comment |
6 Answers
6
active
oldest
votes
Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:
app:
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf' }
root/buildscript/dependencies:
if (!project.hasProperty("disable-performance-plugin")) {
classpath('com.google.firebase:firebase-plugins:1.1.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
when running from the command line use
./gradlew your-task -Pdisable-performance-plugin
when working from Android Studio, add the flag to compiler options:

1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
add a comment |
All of the existing answers are valid, but they all miss something.
To deal with this issue, you have 2 major options to choose from.
1. Use firebasePerformanceInstrumentationEnabled property
This is the official way provided by the SDK itself to disable it during the build process.
What this does:
- Reduces
transformClassesWithFirebasePerformancePluginFor*task execution time to ~5-10s. - Disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
- Only one property to set up.
Cons:
- Doesn't disable performance monitoring completely (if that's what you want).
- Plugin still adds additional ~5-15s to the build time.
How to do this:
I think it's much easier to only enable plugin in those rare cases when we need it (usually it will be only when we publish the app), rather than disable it in all other cases.
Note: Of course, with manual builds you might forget to enable it. So if you don't have CI, maybe it's worth adding some other automatic scripting in Gradle, or sticking to the opposite approach that is used in other answers.
In general though, we only need two steps:
Add the following line to
gradle.propertiesfile:
firebasePerformanceInstrumentationEnabled=false
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true
2. Use custom Gradle project property to avoid applying firebase-perf Gradle plugin
What this does:
- Completely removes
transformClassesWithFirebasePerformancePluginFor*task and also some additional ~5-10s overhead that is present when using the first solution. - Same as the first method – disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
Completely eliminates time expenses associated with Firebase Performance Gradle plugin.
Cons:
- Introduces conditional check for applying plugin in your Gradle script, some might argue that it's not an idiomatic approach.
- Again, doesn't disable performance monitoring completely (if that's what you want).
How to do this:
This approach has similar points and warnings, and also includes two steps:
Modify your app module's
build.gradlefile:
if (project.hasProperty('useFirebasePerf')) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Note: you don't need to apply the same check to your project-level
build.gradle:
classpath "com.google.firebase:firebase-plugins:$firebase_plugins_version"
This declaration won't be used in any way by Gradle when the plugin itself is not enabled.
And you don't need to exclude
guava-jdk5dependency there, if you're using firebase-plugins v1.1.1 or later as stated in the docs.
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PuseFirebasePerf
3. (Additional) Use custom Gradle project property to exclude firebase-perf SDK
If you don't use custom traces or any other features from Firebase Performance SDK and only rely on automatic monitoring (that is, you don't have any dependencies on SDK in your code), then you can exclude this dependency for non-production builds.
Advantage:
- This might save you some additional ~5-10s, spent on configuring dependency and
"ProGuarding" it.
Drawbacks:
- If you were carefully measuring your APK size, you will suddenly see an increase at about 0.4mb. This might disrupt your reports or predictions, so you need to be aware of it.
- Also, if you were close to surpassing 64K method count limit, you might suddenly step over it, see your build fail and find yourself in the MultiDex zone with the need to additionally implement it and test your application. All because Firebase Performance brings a formidable number of almost 5K method references (after applying ProGuard with optimizations).
How to do this:
All you need to do is update your app module's build.gradle file:
If you chose to use the first option, then change your dependency like this:
if (project.property('firebasePerformanceInstrumentationEnabled') == 'true') {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
If you chose the second one:
if (project.hasProperty('useFirebasePerf')) {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
add a comment |
Just to give another option to disable transformClassesWithFirebasePerformancePluginForDebug, here's my recipe:
In main build.gradle folder:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
classpath("com.google.firebase:firebase-plugins:$firebasePluginVersion") {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
In the build.gradle app file:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
apply plugin: 'com.google.firebase.firebase-perf'
}
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
add a comment |
I ran into this problem as well. Originally we had been using a variant of the answer provided by R. Zagórski, but based on a similar thread from the Gradle forums it seems like conditionally applying a plugin to a project isn't the right way to go:
Plugins can’t be applied to only “part of your project”. They are either applied or not.
Conditionally applying plugins does seem to work if you can do it right, but it's not an officially supported feature. Further down the same thread, another point is made:
But the plugin should allow you to configure it at a finer grained level.
Sure enough, there actually is a property exposed by the Firebase plugin that lets you toggle instrumentation on or off (therefore toggling the increased build time). Using this property is tricky, though, since you have to apply it at exactly the right time during the building process, but once you've got that then you can essentially pivot it on whatever you want.
The following code snippet is how we're pivoting instrumentation based on Debug vs. Non-Debug build variants. It's written in Kotlin, but I imagine it would translate to Groovy just as well:
plugins {
...
id ("com.google.firebase.firebase-perf")
}
...
android {
...
applicationVariants.all {
val variant = this
val isFirebaseEnabled = !variant.javaCompiler.name.contains("Debug", true)
gradle.taskGraph.whenReady {
if (this.hasTask(variant.javaCompiler))
{
project.FirebasePerformance.isInstrumentationEnabled = isFirebaseEnabled
}
}
}
...
}
Note that with this in place, the transformClassesWithFirebasePerformancePluginFor* task will still always run for every build variant, but it will complete almost immediately for a variant that doesn't have instrumentation enabled.
1
This is a nice alternative. However, builds withfirebasePerformanceInstrumentationEnabled=falseproperty are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.
– qwertyfinger
Nov 12 '18 at 1:25
add a comment |
I find when Android Studio starts taking ages to build its time to close Android Studio and event at times my computer and reboot. Its better then - have you tried restarting?
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
add a comment |
All comments in this thread are valid. I want to suggest a very simple way to disable that for debug builds:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47380524%2ffirebase-performance-plugin-causing-slow-build-time%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:
app:
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf' }
root/buildscript/dependencies:
if (!project.hasProperty("disable-performance-plugin")) {
classpath('com.google.firebase:firebase-plugins:1.1.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
when running from the command line use
./gradlew your-task -Pdisable-performance-plugin
when working from Android Studio, add the flag to compiler options:

1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
add a comment |
Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:
app:
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf' }
root/buildscript/dependencies:
if (!project.hasProperty("disable-performance-plugin")) {
classpath('com.google.firebase:firebase-plugins:1.1.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
when running from the command line use
./gradlew your-task -Pdisable-performance-plugin
when working from Android Studio, add the flag to compiler options:

1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
add a comment |
Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:
app:
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf' }
root/buildscript/dependencies:
if (!project.hasProperty("disable-performance-plugin")) {
classpath('com.google.firebase:firebase-plugins:1.1.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
when running from the command line use
./gradlew your-task -Pdisable-performance-plugin
when working from Android Studio, add the flag to compiler options:

Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:
app:
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf' }
root/buildscript/dependencies:
if (!project.hasProperty("disable-performance-plugin")) {
classpath('com.google.firebase:firebase-plugins:1.1.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
when running from the command line use
./gradlew your-task -Pdisable-performance-plugin
when working from Android Studio, add the flag to compiler options:

edited Dec 27 '17 at 15:37
answered Dec 27 '17 at 15:26
Ivan KravchenkoIvan Kravchenko
59649
59649
1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
add a comment |
1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
1
1
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
Thank you this worked perfectly. I also am getting a 41% decrease in build times using this fix.
– Ian White
Dec 27 '17 at 16:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
do you think we can use build flavor as the flag ? e.g. if (!BuildConfig.Debug) then enable perf monitor ? - thanks
– Doni
May 24 '18 at 4:28
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
no, this switch either loads plugin or completely removes it from the classpath.
– Ivan Kravchenko
May 27 '18 at 17:10
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
For me it breaks the UI tests, I'm getting error while running UI tests "No tests were found error, Empty Test Suite"
– Dharmendra
Jul 18 '18 at 10:37
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:10
add a comment |
All of the existing answers are valid, but they all miss something.
To deal with this issue, you have 2 major options to choose from.
1. Use firebasePerformanceInstrumentationEnabled property
This is the official way provided by the SDK itself to disable it during the build process.
What this does:
- Reduces
transformClassesWithFirebasePerformancePluginFor*task execution time to ~5-10s. - Disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
- Only one property to set up.
Cons:
- Doesn't disable performance monitoring completely (if that's what you want).
- Plugin still adds additional ~5-15s to the build time.
How to do this:
I think it's much easier to only enable plugin in those rare cases when we need it (usually it will be only when we publish the app), rather than disable it in all other cases.
Note: Of course, with manual builds you might forget to enable it. So if you don't have CI, maybe it's worth adding some other automatic scripting in Gradle, or sticking to the opposite approach that is used in other answers.
In general though, we only need two steps:
Add the following line to
gradle.propertiesfile:
firebasePerformanceInstrumentationEnabled=false
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true
2. Use custom Gradle project property to avoid applying firebase-perf Gradle plugin
What this does:
- Completely removes
transformClassesWithFirebasePerformancePluginFor*task and also some additional ~5-10s overhead that is present when using the first solution. - Same as the first method – disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
Completely eliminates time expenses associated with Firebase Performance Gradle plugin.
Cons:
- Introduces conditional check for applying plugin in your Gradle script, some might argue that it's not an idiomatic approach.
- Again, doesn't disable performance monitoring completely (if that's what you want).
How to do this:
This approach has similar points and warnings, and also includes two steps:
Modify your app module's
build.gradlefile:
if (project.hasProperty('useFirebasePerf')) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Note: you don't need to apply the same check to your project-level
build.gradle:
classpath "com.google.firebase:firebase-plugins:$firebase_plugins_version"
This declaration won't be used in any way by Gradle when the plugin itself is not enabled.
And you don't need to exclude
guava-jdk5dependency there, if you're using firebase-plugins v1.1.1 or later as stated in the docs.
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PuseFirebasePerf
3. (Additional) Use custom Gradle project property to exclude firebase-perf SDK
If you don't use custom traces or any other features from Firebase Performance SDK and only rely on automatic monitoring (that is, you don't have any dependencies on SDK in your code), then you can exclude this dependency for non-production builds.
Advantage:
- This might save you some additional ~5-10s, spent on configuring dependency and
"ProGuarding" it.
Drawbacks:
- If you were carefully measuring your APK size, you will suddenly see an increase at about 0.4mb. This might disrupt your reports or predictions, so you need to be aware of it.
- Also, if you were close to surpassing 64K method count limit, you might suddenly step over it, see your build fail and find yourself in the MultiDex zone with the need to additionally implement it and test your application. All because Firebase Performance brings a formidable number of almost 5K method references (after applying ProGuard with optimizations).
How to do this:
All you need to do is update your app module's build.gradle file:
If you chose to use the first option, then change your dependency like this:
if (project.property('firebasePerformanceInstrumentationEnabled') == 'true') {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
If you chose the second one:
if (project.hasProperty('useFirebasePerf')) {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
add a comment |
All of the existing answers are valid, but they all miss something.
To deal with this issue, you have 2 major options to choose from.
1. Use firebasePerformanceInstrumentationEnabled property
This is the official way provided by the SDK itself to disable it during the build process.
What this does:
- Reduces
transformClassesWithFirebasePerformancePluginFor*task execution time to ~5-10s. - Disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
- Only one property to set up.
Cons:
- Doesn't disable performance monitoring completely (if that's what you want).
- Plugin still adds additional ~5-15s to the build time.
How to do this:
I think it's much easier to only enable plugin in those rare cases when we need it (usually it will be only when we publish the app), rather than disable it in all other cases.
Note: Of course, with manual builds you might forget to enable it. So if you don't have CI, maybe it's worth adding some other automatic scripting in Gradle, or sticking to the opposite approach that is used in other answers.
In general though, we only need two steps:
Add the following line to
gradle.propertiesfile:
firebasePerformanceInstrumentationEnabled=false
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true
2. Use custom Gradle project property to avoid applying firebase-perf Gradle plugin
What this does:
- Completely removes
transformClassesWithFirebasePerformancePluginFor*task and also some additional ~5-10s overhead that is present when using the first solution. - Same as the first method – disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
Completely eliminates time expenses associated with Firebase Performance Gradle plugin.
Cons:
- Introduces conditional check for applying plugin in your Gradle script, some might argue that it's not an idiomatic approach.
- Again, doesn't disable performance monitoring completely (if that's what you want).
How to do this:
This approach has similar points and warnings, and also includes two steps:
Modify your app module's
build.gradlefile:
if (project.hasProperty('useFirebasePerf')) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Note: you don't need to apply the same check to your project-level
build.gradle:
classpath "com.google.firebase:firebase-plugins:$firebase_plugins_version"
This declaration won't be used in any way by Gradle when the plugin itself is not enabled.
And you don't need to exclude
guava-jdk5dependency there, if you're using firebase-plugins v1.1.1 or later as stated in the docs.
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PuseFirebasePerf
3. (Additional) Use custom Gradle project property to exclude firebase-perf SDK
If you don't use custom traces or any other features from Firebase Performance SDK and only rely on automatic monitoring (that is, you don't have any dependencies on SDK in your code), then you can exclude this dependency for non-production builds.
Advantage:
- This might save you some additional ~5-10s, spent on configuring dependency and
"ProGuarding" it.
Drawbacks:
- If you were carefully measuring your APK size, you will suddenly see an increase at about 0.4mb. This might disrupt your reports or predictions, so you need to be aware of it.
- Also, if you were close to surpassing 64K method count limit, you might suddenly step over it, see your build fail and find yourself in the MultiDex zone with the need to additionally implement it and test your application. All because Firebase Performance brings a formidable number of almost 5K method references (after applying ProGuard with optimizations).
How to do this:
All you need to do is update your app module's build.gradle file:
If you chose to use the first option, then change your dependency like this:
if (project.property('firebasePerformanceInstrumentationEnabled') == 'true') {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
If you chose the second one:
if (project.hasProperty('useFirebasePerf')) {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
add a comment |
All of the existing answers are valid, but they all miss something.
To deal with this issue, you have 2 major options to choose from.
1. Use firebasePerformanceInstrumentationEnabled property
This is the official way provided by the SDK itself to disable it during the build process.
What this does:
- Reduces
transformClassesWithFirebasePerformancePluginFor*task execution time to ~5-10s. - Disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
- Only one property to set up.
Cons:
- Doesn't disable performance monitoring completely (if that's what you want).
- Plugin still adds additional ~5-15s to the build time.
How to do this:
I think it's much easier to only enable plugin in those rare cases when we need it (usually it will be only when we publish the app), rather than disable it in all other cases.
Note: Of course, with manual builds you might forget to enable it. So if you don't have CI, maybe it's worth adding some other automatic scripting in Gradle, or sticking to the opposite approach that is used in other answers.
In general though, we only need two steps:
Add the following line to
gradle.propertiesfile:
firebasePerformanceInstrumentationEnabled=false
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true
2. Use custom Gradle project property to avoid applying firebase-perf Gradle plugin
What this does:
- Completely removes
transformClassesWithFirebasePerformancePluginFor*task and also some additional ~5-10s overhead that is present when using the first solution. - Same as the first method – disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
Completely eliminates time expenses associated with Firebase Performance Gradle plugin.
Cons:
- Introduces conditional check for applying plugin in your Gradle script, some might argue that it's not an idiomatic approach.
- Again, doesn't disable performance monitoring completely (if that's what you want).
How to do this:
This approach has similar points and warnings, and also includes two steps:
Modify your app module's
build.gradlefile:
if (project.hasProperty('useFirebasePerf')) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Note: you don't need to apply the same check to your project-level
build.gradle:
classpath "com.google.firebase:firebase-plugins:$firebase_plugins_version"
This declaration won't be used in any way by Gradle when the plugin itself is not enabled.
And you don't need to exclude
guava-jdk5dependency there, if you're using firebase-plugins v1.1.1 or later as stated in the docs.
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PuseFirebasePerf
3. (Additional) Use custom Gradle project property to exclude firebase-perf SDK
If you don't use custom traces or any other features from Firebase Performance SDK and only rely on automatic monitoring (that is, you don't have any dependencies on SDK in your code), then you can exclude this dependency for non-production builds.
Advantage:
- This might save you some additional ~5-10s, spent on configuring dependency and
"ProGuarding" it.
Drawbacks:
- If you were carefully measuring your APK size, you will suddenly see an increase at about 0.4mb. This might disrupt your reports or predictions, so you need to be aware of it.
- Also, if you were close to surpassing 64K method count limit, you might suddenly step over it, see your build fail and find yourself in the MultiDex zone with the need to additionally implement it and test your application. All because Firebase Performance brings a formidable number of almost 5K method references (after applying ProGuard with optimizations).
How to do this:
All you need to do is update your app module's build.gradle file:
If you chose to use the first option, then change your dependency like this:
if (project.property('firebasePerformanceInstrumentationEnabled') == 'true') {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
If you chose the second one:
if (project.hasProperty('useFirebasePerf')) {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
All of the existing answers are valid, but they all miss something.
To deal with this issue, you have 2 major options to choose from.
1. Use firebasePerformanceInstrumentationEnabled property
This is the official way provided by the SDK itself to disable it during the build process.
What this does:
- Reduces
transformClassesWithFirebasePerformancePluginFor*task execution time to ~5-10s. - Disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
- Only one property to set up.
Cons:
- Doesn't disable performance monitoring completely (if that's what you want).
- Plugin still adds additional ~5-15s to the build time.
How to do this:
I think it's much easier to only enable plugin in those rare cases when we need it (usually it will be only when we publish the app), rather than disable it in all other cases.
Note: Of course, with manual builds you might forget to enable it. So if you don't have CI, maybe it's worth adding some other automatic scripting in Gradle, or sticking to the opposite approach that is used in other answers.
In general though, we only need two steps:
Add the following line to
gradle.propertiesfile:
firebasePerformanceInstrumentationEnabled=false
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true
2. Use custom Gradle project property to avoid applying firebase-perf Gradle plugin
What this does:
- Completely removes
transformClassesWithFirebasePerformancePluginFor*task and also some additional ~5-10s overhead that is present when using the first solution. - Same as the first method – disables automatic traces and request monitoring, but leaves custom traces enabled. You can control the latter with AndroidManifest
<meta-data>tags and calls toFirebasePerformance.getInstance().setPerformanceCollectionEnabled(). More info in the docs.
Pros:
Completely eliminates time expenses associated with Firebase Performance Gradle plugin.
Cons:
- Introduces conditional check for applying plugin in your Gradle script, some might argue that it's not an idiomatic approach.
- Again, doesn't disable performance monitoring completely (if that's what you want).
How to do this:
This approach has similar points and warnings, and also includes two steps:
Modify your app module's
build.gradlefile:
if (project.hasProperty('useFirebasePerf')) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Note: you don't need to apply the same check to your project-level
build.gradle:
classpath "com.google.firebase:firebase-plugins:$firebase_plugins_version"
This declaration won't be used in any way by Gradle when the plugin itself is not enabled.
And you don't need to exclude
guava-jdk5dependency there, if you're using firebase-plugins v1.1.1 or later as stated in the docs.
Use the following command in your CI config or manual builds:
./gradlew assembleRelease -PuseFirebasePerf
3. (Additional) Use custom Gradle project property to exclude firebase-perf SDK
If you don't use custom traces or any other features from Firebase Performance SDK and only rely on automatic monitoring (that is, you don't have any dependencies on SDK in your code), then you can exclude this dependency for non-production builds.
Advantage:
- This might save you some additional ~5-10s, spent on configuring dependency and
"ProGuarding" it.
Drawbacks:
- If you were carefully measuring your APK size, you will suddenly see an increase at about 0.4mb. This might disrupt your reports or predictions, so you need to be aware of it.
- Also, if you were close to surpassing 64K method count limit, you might suddenly step over it, see your build fail and find yourself in the MultiDex zone with the need to additionally implement it and test your application. All because Firebase Performance brings a formidable number of almost 5K method references (after applying ProGuard with optimizations).
How to do this:
All you need to do is update your app module's build.gradle file:
If you chose to use the first option, then change your dependency like this:
if (project.property('firebasePerformanceInstrumentationEnabled') == 'true') {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
If you chose the second one:
if (project.hasProperty('useFirebasePerf')) {
implementation "com.google.firebase:firebase-perf:${firebase_perf_version}"
}
edited Nov 13 '18 at 5:14
answered Nov 12 '18 at 21:43
qwertyfingerqwertyfinger
16329
16329
add a comment |
add a comment |
Just to give another option to disable transformClassesWithFirebasePerformancePluginForDebug, here's my recipe:
In main build.gradle folder:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
classpath("com.google.firebase:firebase-plugins:$firebasePluginVersion") {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
In the build.gradle app file:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
apply plugin: 'com.google.firebase.firebase-perf'
}
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
add a comment |
Just to give another option to disable transformClassesWithFirebasePerformancePluginForDebug, here's my recipe:
In main build.gradle folder:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
classpath("com.google.firebase:firebase-plugins:$firebasePluginVersion") {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
In the build.gradle app file:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
apply plugin: 'com.google.firebase.firebase-perf'
}
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
add a comment |
Just to give another option to disable transformClassesWithFirebasePerformancePluginForDebug, here's my recipe:
In main build.gradle folder:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
classpath("com.google.firebase:firebase-plugins:$firebasePluginVersion") {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
In the build.gradle app file:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
apply plugin: 'com.google.firebase.firebase-perf'
}
Just to give another option to disable transformClassesWithFirebasePerformancePluginForDebug, here's my recipe:
In main build.gradle folder:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
classpath("com.google.firebase:firebase-plugins:$firebasePluginVersion") {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
In the build.gradle app file:
if (!project.gradle.startParameter.taskNames.any { taskName ->
taskName.toLowerCase().contains('assemble') && taskName.toLowerCase().contains('debug') }) {
apply plugin: 'com.google.firebase.firebase-perf'
}
edited Jul 6 '18 at 12:42
André Kool
3,33192639
3,33192639
answered Jul 6 '18 at 10:47
R. ZagórskiR. Zagórski
13.8k23563
13.8k23563
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
add a comment |
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
1
1
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
I think excluding Guava is not needed for v1.1.1 or later as stated in the docs. Also, it's not necessary to add conditional statement to classpath declaration. If you don't apply plugin, it won't be used in any way by Gradle.
– qwertyfinger
Nov 13 '18 at 5:09
add a comment |
I ran into this problem as well. Originally we had been using a variant of the answer provided by R. Zagórski, but based on a similar thread from the Gradle forums it seems like conditionally applying a plugin to a project isn't the right way to go:
Plugins can’t be applied to only “part of your project”. They are either applied or not.
Conditionally applying plugins does seem to work if you can do it right, but it's not an officially supported feature. Further down the same thread, another point is made:
But the plugin should allow you to configure it at a finer grained level.
Sure enough, there actually is a property exposed by the Firebase plugin that lets you toggle instrumentation on or off (therefore toggling the increased build time). Using this property is tricky, though, since you have to apply it at exactly the right time during the building process, but once you've got that then you can essentially pivot it on whatever you want.
The following code snippet is how we're pivoting instrumentation based on Debug vs. Non-Debug build variants. It's written in Kotlin, but I imagine it would translate to Groovy just as well:
plugins {
...
id ("com.google.firebase.firebase-perf")
}
...
android {
...
applicationVariants.all {
val variant = this
val isFirebaseEnabled = !variant.javaCompiler.name.contains("Debug", true)
gradle.taskGraph.whenReady {
if (this.hasTask(variant.javaCompiler))
{
project.FirebasePerformance.isInstrumentationEnabled = isFirebaseEnabled
}
}
}
...
}
Note that with this in place, the transformClassesWithFirebasePerformancePluginFor* task will still always run for every build variant, but it will complete almost immediately for a variant that doesn't have instrumentation enabled.
1
This is a nice alternative. However, builds withfirebasePerformanceInstrumentationEnabled=falseproperty are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.
– qwertyfinger
Nov 12 '18 at 1:25
add a comment |
I ran into this problem as well. Originally we had been using a variant of the answer provided by R. Zagórski, but based on a similar thread from the Gradle forums it seems like conditionally applying a plugin to a project isn't the right way to go:
Plugins can’t be applied to only “part of your project”. They are either applied or not.
Conditionally applying plugins does seem to work if you can do it right, but it's not an officially supported feature. Further down the same thread, another point is made:
But the plugin should allow you to configure it at a finer grained level.
Sure enough, there actually is a property exposed by the Firebase plugin that lets you toggle instrumentation on or off (therefore toggling the increased build time). Using this property is tricky, though, since you have to apply it at exactly the right time during the building process, but once you've got that then you can essentially pivot it on whatever you want.
The following code snippet is how we're pivoting instrumentation based on Debug vs. Non-Debug build variants. It's written in Kotlin, but I imagine it would translate to Groovy just as well:
plugins {
...
id ("com.google.firebase.firebase-perf")
}
...
android {
...
applicationVariants.all {
val variant = this
val isFirebaseEnabled = !variant.javaCompiler.name.contains("Debug", true)
gradle.taskGraph.whenReady {
if (this.hasTask(variant.javaCompiler))
{
project.FirebasePerformance.isInstrumentationEnabled = isFirebaseEnabled
}
}
}
...
}
Note that with this in place, the transformClassesWithFirebasePerformancePluginFor* task will still always run for every build variant, but it will complete almost immediately for a variant that doesn't have instrumentation enabled.
1
This is a nice alternative. However, builds withfirebasePerformanceInstrumentationEnabled=falseproperty are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.
– qwertyfinger
Nov 12 '18 at 1:25
add a comment |
I ran into this problem as well. Originally we had been using a variant of the answer provided by R. Zagórski, but based on a similar thread from the Gradle forums it seems like conditionally applying a plugin to a project isn't the right way to go:
Plugins can’t be applied to only “part of your project”. They are either applied or not.
Conditionally applying plugins does seem to work if you can do it right, but it's not an officially supported feature. Further down the same thread, another point is made:
But the plugin should allow you to configure it at a finer grained level.
Sure enough, there actually is a property exposed by the Firebase plugin that lets you toggle instrumentation on or off (therefore toggling the increased build time). Using this property is tricky, though, since you have to apply it at exactly the right time during the building process, but once you've got that then you can essentially pivot it on whatever you want.
The following code snippet is how we're pivoting instrumentation based on Debug vs. Non-Debug build variants. It's written in Kotlin, but I imagine it would translate to Groovy just as well:
plugins {
...
id ("com.google.firebase.firebase-perf")
}
...
android {
...
applicationVariants.all {
val variant = this
val isFirebaseEnabled = !variant.javaCompiler.name.contains("Debug", true)
gradle.taskGraph.whenReady {
if (this.hasTask(variant.javaCompiler))
{
project.FirebasePerformance.isInstrumentationEnabled = isFirebaseEnabled
}
}
}
...
}
Note that with this in place, the transformClassesWithFirebasePerformancePluginFor* task will still always run for every build variant, but it will complete almost immediately for a variant that doesn't have instrumentation enabled.
I ran into this problem as well. Originally we had been using a variant of the answer provided by R. Zagórski, but based on a similar thread from the Gradle forums it seems like conditionally applying a plugin to a project isn't the right way to go:
Plugins can’t be applied to only “part of your project”. They are either applied or not.
Conditionally applying plugins does seem to work if you can do it right, but it's not an officially supported feature. Further down the same thread, another point is made:
But the plugin should allow you to configure it at a finer grained level.
Sure enough, there actually is a property exposed by the Firebase plugin that lets you toggle instrumentation on or off (therefore toggling the increased build time). Using this property is tricky, though, since you have to apply it at exactly the right time during the building process, but once you've got that then you can essentially pivot it on whatever you want.
The following code snippet is how we're pivoting instrumentation based on Debug vs. Non-Debug build variants. It's written in Kotlin, but I imagine it would translate to Groovy just as well:
plugins {
...
id ("com.google.firebase.firebase-perf")
}
...
android {
...
applicationVariants.all {
val variant = this
val isFirebaseEnabled = !variant.javaCompiler.name.contains("Debug", true)
gradle.taskGraph.whenReady {
if (this.hasTask(variant.javaCompiler))
{
project.FirebasePerformance.isInstrumentationEnabled = isFirebaseEnabled
}
}
}
...
}
Note that with this in place, the transformClassesWithFirebasePerformancePluginFor* task will still always run for every build variant, but it will complete almost immediately for a variant that doesn't have instrumentation enabled.
answered Oct 15 '18 at 18:39
IniritInirit
213
213
1
This is a nice alternative. However, builds withfirebasePerformanceInstrumentationEnabled=falseproperty are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.
– qwertyfinger
Nov 12 '18 at 1:25
add a comment |
1
This is a nice alternative. However, builds withfirebasePerformanceInstrumentationEnabled=falseproperty are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.
– qwertyfinger
Nov 12 '18 at 1:25
1
1
This is a nice alternative. However, builds with
firebasePerformanceInstrumentationEnabled=false property are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.– qwertyfinger
Nov 12 '18 at 1:25
This is a nice alternative. However, builds with
firebasePerformanceInstrumentationEnabled=false property are still 5-15 seconds slower than the ones with disabled firebase-perf plugin.– qwertyfinger
Nov 12 '18 at 1:25
add a comment |
I find when Android Studio starts taking ages to build its time to close Android Studio and event at times my computer and reboot. Its better then - have you tried restarting?
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
add a comment |
I find when Android Studio starts taking ages to build its time to close Android Studio and event at times my computer and reboot. Its better then - have you tried restarting?
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
add a comment |
I find when Android Studio starts taking ages to build its time to close Android Studio and event at times my computer and reboot. Its better then - have you tried restarting?
I find when Android Studio starts taking ages to build its time to close Android Studio and event at times my computer and reboot. Its better then - have you tried restarting?
answered Nov 19 '17 at 18:39
Samantha EastwoodSamantha Eastwood
846
846
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
add a comment |
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
After rebooting, the same gradle task is still taking a long time
– Ian White
Nov 19 '17 at 18:53
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
does this help: stackoverflow.com/questions/29391421/…
– Samantha Eastwood
Nov 19 '17 at 19:16
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
No, none of these fixes have changed my gradle build time
– Ian White
Nov 19 '17 at 19:26
add a comment |
All comments in this thread are valid. I want to suggest a very simple way to disable that for debug builds:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
add a comment |
All comments in this thread are valid. I want to suggest a very simple way to disable that for debug builds:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
add a comment |
All comments in this thread are valid. I want to suggest a very simple way to disable that for debug builds:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
All comments in this thread are valid. I want to suggest a very simple way to disable that for debug builds:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
answered 2 days ago
Romain PielRomain Piel
6,901115599
6,901115599
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47380524%2ffirebase-performance-plugin-causing-slow-build-time%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
There is a post-compilation phase when using Firebase Performance on Android. It has to look at all of your app's class files. This is normal.
– Doug Stevenson
Nov 19 '17 at 23:09
@DougStevenson is it possible to not do this and use no-op variant in some builds? e.g. debug build used during development?
– Martin Rajniak
Apr 18 '18 at 14:02