mauron85 / react-native-background-geolocation

Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.
Apache License 2.0
1.33k stars 560 forks source link

Cannot change artifacts of configuration ':@mauron85_react-native-background-geolocation:default' after it has been included in dependency resolution. #448

Open gusma296 opened 4 years ago

gusma296 commented 4 years ago

Error after add react-native-onesignal and run ./gradlew clean or react-native run-android please help for fix this error thanks `FAILURE: Build failed with an exception.

sarmad1995 commented 4 years ago

Same here, seems like when we use onesignal, this happens.

risardi123 commented 4 years ago

Same here, please someone help to fix this.

ghost commented 4 years ago

I don't know if there will be any issues but 0.5.6 version works with react-native 0.61.4, and i am using it without problem. Keep in mind that 0.5.6 is an old version made for react-native >= 0.57

gusma296 commented 4 years ago

I don't know if there will be any issues but 0.5.6 version works with react-native 0.61.4, and i am using it without problem. Keep in mind that 0.5.6 is an old version made for react-native >= 0.57

not work after add react-native-onesignal

ghost commented 4 years ago

Strange. 0.6.3 wasnt working for me either but after downgrading to 0.5.6, it works fine. I can't help you how i made it work (because i don't know), i'm new at android. Doesn't work on iOS

"react-native": "0.61.4",
"@mauron85/react-native-background-geolocation": "0.5.6",
"react-native-onesignal": "^3.5.0",
gusma296 commented 4 years ago

Strange. 0.6.3 wasnt working for me either but after downgrading to 0.5.6, it works fine. I can't help you how i made it work (because i don't know), i'm new at android.

"react-native": "0.61.4",
"@mauron85/react-native-background-geolocation": "0.5.6",
"react-native-onesignal": "^3.5.0",

thanks this is work for me

sarmad1995 commented 4 years ago

This isn't a permanent solution

gusma296 commented 4 years ago

This isn't a permanent solution

temporary solution, until waiting @mauron85 update

gusma296 commented 4 years ago

Strange. 0.6.3 wasnt working for me either but after downgrading to 0.5.6, it works fine. I can't help you how i made it work (because i don't know), i'm new at android.

"react-native": "0.61.4",
"@mauron85/react-native-background-geolocation": "0.5.6",
"react-native-onesignal": "^3.5.0",

this solution not work on IOS

ghost commented 4 years ago

Yep, just tested. Doesn't work on ios. Crash log: CRASH: Invalid parameter not satisfying: !stayUp. @mauron85 Are you planning to fix it soon?

risardi123 commented 4 years ago

Strange. 0.6.3 wasnt working for me either but after downgrading to 0.5.6, it works fine. I can't help you how i made it work (because i don't know), i'm new at android.

"react-native": "0.61.4",
"@mauron85/react-native-background-geolocation": "0.5.6",
"react-native-onesignal": "^3.5.0",

this solution not work on IOS

Solve the problem change your package.json version (ios 0.6.3 mauron), for android go to (android 0.5.6 mauron). Every time you change package.json don't forget to clean your node modules "rm -rf node_modules && yarn install". cheers

martianatwork commented 4 years ago

@mauron85 can you please take a look at this issue? There must be some conflicting issues with onesignal

martianatwork commented 4 years ago

Fixed & Tested!! remove following line from your app/build.gradle -> apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

This is required only if you run into any issues with duplicate classes. i found it in onesignal build.gradle file

eabuslaiman30 commented 4 years ago

After two hours, this works.

I was using react-native-firebase for storage, react-native-onesignal for push notifications and this library for geolocation features.

At first, I commented this line from my app/build.gradle

// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

Add following lines at the bottom

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Dependencies section from that same file are:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:multidex:1.0.0"

    implementation project(':react-native-firebase')
    implementation project(':react-native-navigation')
    implementation project(':@mauron85_react-native-background-geolocation')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-splash-screen')

    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.android.gms:play-services-location:15.0.1"

    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-messaging:18.0.0"
    implementation "com.google.firebase:firebase-analytics:17.0.0"
    implementation "com.google.firebase:firebase-storage:17.0.0"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

My build.gradle file (at the root, not from app/ folder):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 18
        compileSdkVersion = 28
        targetSdkVersion = 28

        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "11+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url 'https://jitpack.io' }
    }
}

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                            names.contains("reactNative51") ||
                            names.contains("reactNative55") ||
                            names.contains("reactNative56") ||
                            names.contains("reactNative57") ||
                            names.contains("reactNative57_5")
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

Finally, my versions from the package json:

"@mauron85/react-native-background-geolocation": "^0.6.3",
"react-native-onesignal": "^3.6.1",
"react-native-firebase": "^5.6.0"

Hope to help someone. Cheers!

sostenesg7 commented 4 years ago

After two hours, this works.

I was using react-native-firebase for storage, react-native-onesignal for push notifications and this library for geolocation features.

At first, I commented this line from my app/build.gradle

// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

Add following lines at the bottom

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Dependencies section from that same file are:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:multidex:1.0.0"

    implementation project(':react-native-firebase')
    implementation project(':react-native-navigation')
    implementation project(':@mauron85_react-native-background-geolocation')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-splash-screen')

    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.android.gms:play-services-location:15.0.1"

    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-messaging:18.0.0"
    implementation "com.google.firebase:firebase-analytics:17.0.0"
    implementation "com.google.firebase:firebase-storage:17.0.0"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

My build.gradle file (at the root, not from app/ folder):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 18
        compileSdkVersion = 28
        targetSdkVersion = 28

        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "11+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url 'https://jitpack.io' }
    }
}

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                            names.contains("reactNative51") ||
                            names.contains("reactNative55") ||
                            names.contains("reactNative56") ||
                            names.contains("reactNative57") ||
                            names.contains("reactNative57_5")
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

Finally, my versions from the package json:

"@mauron85/react-native-background-geolocation": "^0.6.3",
"react-native-onesignal": "^3.6.1",
"react-native-firebase": "^5.6.0"

Hope to help someone. Cheers!

Thanks, this works perfectly

akinncar commented 4 years ago

// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

Only comments this line solve my problem, please, close this issue

lyseiha commented 3 years ago

stilll not working

risardi123 commented 3 years ago

If your project run for company, I suggest you to buy this lib https://github.com/transistorsoft/react-native-background-geolocation. Because this library won't help you. Sorry for that

blitsoftwares commented 3 years ago

After two hours, this works.

I was using react-native-firebase for storage, react-native-onesignal for push notifications and this library for geolocation features.

At first, I commented this line from my app/build.gradle

// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

Add following lines at the bottom

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Dependencies section from that same file are:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:multidex:1.0.0"

    implementation project(':react-native-firebase')
    implementation project(':react-native-navigation')
    implementation project(':@mauron85_react-native-background-geolocation')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-splash-screen')

    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.android.gms:play-services-location:15.0.1"

    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-messaging:18.0.0"
    implementation "com.google.firebase:firebase-analytics:17.0.0"
    implementation "com.google.firebase:firebase-storage:17.0.0"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

My build.gradle file (at the root, not from app/ folder):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 18
        compileSdkVersion = 28
        targetSdkVersion = 28

        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "11+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url 'https://jitpack.io' }
    }
}

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                            names.contains("reactNative51") ||
                            names.contains("reactNative55") ||
                            names.contains("reactNative56") ||
                            names.contains("reactNative57") ||
                            names.contains("reactNative57_5")
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

Finally, my versions from the package json:

"@mauron85/react-native-background-geolocation": "^0.6.3",
"react-native-onesignal": "^3.6.1",
"react-native-firebase": "^5.6.0"

Hope to help someone. Cheers!

P E R F E C T ! Thanks !!!!