huynqbibabo / react-native-newrelic

MIT License
8 stars 3 forks source link

feat: allow overriding the newrelic sdk version on Android #4

Closed IjzerenHein closed 2 years ago

IjzerenHein commented 2 years ago

The latest 6.x version seems to be given problems in certain environments. This PR extends the library to allow overriding the default newrelic version. By default, it will still select the 6.+ version making this PR fully backwards compatible.

To override it in your app, add the following config to your android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30

        // Latest NewRelic android Agent fails with OkHttp. Revert to 6.1.0
        // https://github.com/newrelic-experimental/NewRelicReactNativeModule/issues/17#issuecomment-1011137629
        newrelicVersion = "6.1.0"
    }
    ...
}
ChrisLFieldsII commented 2 years ago

This was extremely helpful, thank you!

Since another version has not yet been deployed, I had to use patch-package to get this functionality to work with version 1.9.0