React-native-background-geolocation: Could not get unknown property 'android' for project ':app' of type org.gradle.api.Project.

Created on 11 Apr 2018  路  11Comments  路  Source: mauron85/react-native-background-geolocation


downgraded gradle and now this issue .All I have done was install@latest and react-native link 'project;

Your Environment

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer and model:
  • React Native version:
  • Plugin configuration options:
  • Link to your project:

Context

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce



1.
2.
3.
4.

Context

Debug logs

Most helpful comment

OK Turns out for me the issue was in the android-common submodule:

I needed to change in VERSIONS.gradle:

    if (findProject('..:app') != null) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

to:

    if (findProject('..:app') != null && project('..:app').hasProperty('android')) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null && project(':app').hasProperty('android')) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

All 11 comments

Anyone have solution for this ?

I'm having the same. I just enabled gradle3 like it made in there https://github.com/mauron85/react-native-mauron85-background-geolocation-skeleton
I'm not experienced with android development (web only). Can anyone help me please? Thanks.

I had to abandon my project. Just because I couldn't solve this issue :/ https://github.com/mauron85/react-native-background-geolocation/issues/217

I downgraded buildToolsVersion and `supportLibVersion

ext {
    compileSdkVersion = 26
    targetSdkVersion = 26
    buildToolsVersion = "26.0.2"
    supportLibVersion = "25.3.1"
    googlePlayServicesVersion = "11.8.0"
//    oreoEXPERIMENTAL = "yes"
    gradle3EXPERIMENTAL = "yes"
}

so now it builds but my app crashes right on start.
if I comment this string in MainApplication.java
image
then no crash on start, but geolocation does not work. ((

@j-mendez Why'd you close this? What was the solution?

OK Turns out for me the issue was in the android-common submodule:

I needed to change in VERSIONS.gradle:

    if (findProject('..:app') != null) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

to:

    if (findProject('..:app') != null && project('..:app').hasProperty('android')) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null && project(':app').hasProperty('android')) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

@tmaly1980 very nice find.
I think the issue is in settings.gradle

I really wonder why can't it see the android property tho, because for my project it is there.

@tmaly1980 sorry, should have posted the solution. Setup your project for AndroidX and it should work.

OK Turns out for me the issue was in the android-common submodule:

I needed to change in VERSIONS.gradle:

    if (findProject('..:app') != null) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

to:

    if (findProject('..:app') != null && project('..:app').hasProperty('android')) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null && project(':app').hasProperty('android')) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

This worked for me on RN 0.62.2 - thank you. I wonder if I could turn it into patch-module..

OK Turns out for me the issue was in the android-common submodule:
I needed to change in VERSIONS.gradle:

    if (findProject('..:app') != null) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

to:

    if (findProject('..:app') != null && project('..:app').hasProperty('android')) {
        applicationId = project('..:app').android.defaultConfig.applicationId
    } else if (findProject(':app') != null && project(':app').hasProperty('android')) {
        applicationId = project(':app').android.defaultConfig.applicationId
    }

This worked for me on RN 0.62.2 - thank you. I wonder if I could turn it into patch-module..

Why i don't have file VERSION.gradle in my project?

@tmaly1980 sorry, should have posted the solution. Setup your project for AndroidX and it should work.

can you say detail about steps to setup?Please

Was this page helpful?
0 / 5 - 0 ratings