How we solved same problem: We have two Google Analytics trackers for one project.
Via product flavors we can pass different classes, different resources and buildConfigFields via build.gradle productFlavors closure, so for test builds (which developers use for debug purposes) we set different g_analytics.xml (with testTrackingId), so we don't worry about flooding product flavor statistics. *Just try product flavors as addition to build types*, I think they will satisfy 99% of your needs понедельник, 22 сентября 2014 г., 14:00:56 UTC+4 пользователь Tomáš Procházka написал: > > It is possible to detect in the gradde script if build was started from > the IDE or from the commandline? > вторник, 23 сентября 2014 г., 10:41:24 UTC+4 пользователь Tomáš Procházka написал: > > Thanks. > We also use build type debug/release, it control logging, enable Google > Analytics, etc. > But for example crittercism we have enabled on booth debug and release > build, but we want to have it of in IDE build, to do not flood statistic > with dev crashes. > > > Dne pondělí, 22. září 2014 22:22:49 UTC+2 Xavier Ducrohet napsal(a): >> >> I agree with Mark, this is what build types are for. You can have >> different BuildConfig constants depending on the build type you are >> building. >> >> That said you can in fact detect if the build was done from the IDE. We >> inject a property called android.injected.invoked.from.ide when building >> from the IDE >> >> On Mon, Sep 22, 2014 at 1:00 PM, Mark Murphy <[email protected]> >> wrote: >> >>> On Mon, Sep 22, 2014, at 15:43, Tomáš Procházka wrote: >>> > I need it because I have special method App.isIDEBuild() in my app that >>> > allow me to setup special debug stuff, like prefill login screen with >>> > passwords, skip some screens to speed up development. But if app is >>> > builded >>> > from command line (on CI server), it must work as usual. So it is much >>> > better to use App.isIDEBuild() than change code itself and forgot >>> remove >>> > something. >>> >>> I would differentiate based on build type, either using >>> BuildConfig.DEBUG (if I didn't need the CI server to make debug builds) >>> or a custom BuildConfig field. Basically, you anoint one build type as >>> being the "IDE build", and use other build types on the CI server. >>> >>> -- >>> Mark Murphy (a Commons Guy) >>> http://commonsware.com | http://github.com/commonsguy >>> http://commonsware.com/blog | http://twitter.com/commonsguy >>> >>> _The Busy Coder's Guide to Android Development_ Version 6.0: Android >>> Studio-ified! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "adt-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Xavier Ducrohet >> Android SDK Tech Lead >> Google Inc. >> http://developer.android.com | http://tools.android.com >> >> Please do not send me questions directly. Thanks! >> > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
