flurry / react-native-flurry-sdk

React Native Flurry SDK
Apache License 2.0
45 stars 13 forks source link

Should support external SDK version on Android #40

Closed winderbro closed 2 years ago

winderbro commented 2 years ago

This Feature Request is About Should support external SDK version on Android

Platform

apply plugin: 'com.android.library'

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:3.2.1"
    }
}

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 28)
    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 28)
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$projectDir/../../../node_modules/react-native/android"
    }
    mavenCentral()
    google()
    jcenter()
}

dependencies {
    // implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

    implementation 'com.facebook.react:react-native:+'
    implementation 'com.flurry.android:analytics:13.1.0'
    implementation 'com.flurry.android:marketing:13.1.0'
}
poting-oath commented 2 years ago

@winderbro This requested feature can be dangerous because the root project settings may not be compatible with the Flurry plugin. Is this feature common to other plugins?

Namachi06 commented 2 years ago

@winderbro This requested feature can be dangerous because the root project settings may not be compatible with the Flurry plugin. Is this feature common to other plugins?

Hello @poting-oath,

Many other packages use 'safeExtGet' method in order to avoid compatibility problems with their current react-native project. Indeed, other packages require at least a minSdkVersion at 21 which can result, in my case, a build failure as shown below:

Capture d’écran 2022-03-01 à 11 47 56

This is the reason why minSdkVersion and targetSdkVersion should not be hardcoded.

In order to solve my issue, I had to change minSdkVersion 16 to minSdkVersion safeExtGet('minSdkVersion', 16) from react-native-flurry-sdk package. 😄

poting-oath commented 2 years ago

@Namachi06 Thanks for the info! The update will be available in the next release. FYI, buildToolsVersion will continue not defined here as Android guideline. Thanks!

poting-oath commented 2 years ago

@winderbro @Namachi06 This implementation has been released in version 7.2.0. Thanks very much for your input!