Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for project-wide gradle configuration properties #1380

Merged
merged 1 commit into from Mar 23, 2018

Conversation

@anandprabhu
Copy link
Contributor

anandprabhu commented Mar 21, 2018

Adding support for the Project-wide Gradle configuration properties as recommended by the Google Android Developer document Gradle Tips & Tricks. The hosting ReactNative application can define the following properties in their android/build.gradle file and the dependency modules like react-native-camera can align it's dependencies as requested:

buildscript {...}
allprojects {...}

/**
 + Project-wide Gradle configuration properties
 */
ext {
    compileSdkVersion   = 26
    targetSdkVersion    = 26
    buildToolsVersion   = "26.0.2"
    googlePlayServicesVersion = "10.2.0"
    supportLibVersion   = "27.1.0"
}

The PR is inspired by a similar PR by @christocracy for the react-native-maps

@christocracy

This comment has been minimized.

Copy link
Collaborator

christocracy commented Mar 21, 2018

Don't use the variable name exifInterfaceSupportVersion. Just call it supportLibVersion so we're all compatible with each other.

@christocracy

This comment has been minimized.

Copy link
Collaborator

christocracy commented Mar 21, 2018

@anandprabhu

This comment has been minimized.

Copy link
Contributor Author

anandprabhu commented Mar 21, 2018

Hi @christocracy sure would update the same.

@anandprabhu

This comment has been minimized.

Copy link
Contributor Author

anandprabhu commented Mar 21, 2018

Hi @christocracy have update the PR based on your comments.
Hi @sibelius can you look into this PR.

@christocracy

This comment has been minimized.

Copy link
Collaborator

christocracy commented Mar 21, 2018

You should update your Android setup instructions.

Here's my react-native-background-geolocation Android setup docs.

Here's my react-native-background-fetch Android setup docs.

Here's a Wiki entry I add as well

@anandwahed

This comment has been minimized.

Copy link

anandwahed commented Mar 22, 2018

@christocracy I have updated the readme with the required steps.

@sibelius

This comment has been minimized.

Copy link
Member

sibelius commented Mar 23, 2018

@christocracy is this good enough?

@christocracy

This comment has been minimized.

Copy link
Collaborator

christocracy commented Mar 23, 2018

Yes, looks fine.

@sibelius sibelius merged commit e0cb628 into react-native-community:master Mar 23, 2018
@ludalex

This comment has been minimized.

Copy link

ludalex commented Mar 27, 2018

I think there's something misaligned with the current instructions on master, or I'm doing something really wrong.

First of all, if I don't add maven { url 'https://maven.google.com' } to my allprojects.repositories in android/build.gradle, I get this error:

Could not find com.android.support:exifinterface:27.1.0.
Required by:
    MyAppName:app:unspecified

When I do add it, I finally get the error that this PR is meant to fix (Error: more than one library with package name 'com.google.android.gms.license')

So here's how my android/build.gradle is looking:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

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

    }
}

ext {
    compileSdkVersion   = 26
    targetSdkVersion    = 26
    buildToolsVersion   = "26.0.2"
    googlePlayServicesVersion = "10.2.0"
    supportLibVersion   = "27.1.0"
}

And yes I've added:

  compile (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
        compile 'com.android.support:exifinterface:25.+'
        compile ('com.google.android.gms:play-services-vision:10.2.0') {
            force = true
        }
    }

to android/app/build.grade

@christocracy

This comment has been minimized.

Copy link
Collaborator

christocracy commented Mar 27, 2018

Google now hosts their packages at their own maven server, so yea: if trying to import recent com.android.support libs, the google maven url should be added to install instructions.

@sibelius

This comment has been minimized.

Copy link
Member

sibelius commented Mar 27, 2018

we should

@anandprabhu

This comment has been minimized.

Copy link
Contributor Author

anandprabhu commented Mar 28, 2018

@sibelius and @christocracy have created a new PR (#1409) to update the doc to include the Google's maven server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.