Last active
March 9, 2021 15:54
-
-
Save AlexKorovyansky/9da560b3aba25fdb0ce3 to your computer and use it in GitHub Desktop.
Trick for separating Develop from Release versions in New Relic Mobile SDK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
android.applicationVariants.all { variant -> | |
task ("prepareNewRelicProperties${variant.name.capitalize()}"){ | |
doLast { | |
copy { | |
from variant.buildType.debuggable ? "${project.projectDir}/src/debug" : "${project.projectDir}/src/release" | |
into "${project.projectDir}" | |
include "newrelic.properties.*" | |
rename "newrelic.properties.*", "newrelic.properties" | |
} | |
} | |
} | |
tasks.getByName("prepare${variant.name.capitalize()}Dependencies").dependsOn("prepareNewRelicProperties${variant.name.capitalize()}") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# should be located in src/debug | |
com.newrelic.application_token=MyNewRelicDebugApplicationToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# should be located in src/release | |
com.newrelic.application_token=MyNewRelicReleaseApplicationToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
NewRelic.withApplicationToken(getString(R.string.my_new_relic_application_token).start(this); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--should be located in src/debug/res/values--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="my_new_relic_application_token">MyNewRelicDebugApplicationToken</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--should be located in src/release/res/values--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="my_new_relic_application_token">MyNewRelicReleaseApplicationToken</string> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment