diff --git a/README.md b/README.md index 29acdbe..67038d9 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ iOS/Android Google Places Widgets (Autocomplete, Place Picker) and API Services ## Versioning: -- for RN >= 0.40.0, use v2+ (e.g. react-native-google-places@2.4.0) -- for RN (0.33.0 - 0.39.0), use v1+ or 0.8.8 (e.g. react-native-google-places@1.1.0) +- for RN >= 0.40.0, use v2+ (e.g. react-native-google-places@2.5.0) +- for RN (0.33.0 - 0.39.0), use v1+ or 0.8.8 (e.g. react-native-google-places@1.1.0) **No longer updated** ## Sample App - A new [sample app](https://github.com/tolu360/TestRNGP) is available to help with sample usage and debugging issues. @@ -106,6 +106,46 @@ dependencies { compile project(':react-native-google-places') } ``` +- Option 1: Use Project-Wide Gradle Config: + +You can define *[project-wide properties](https://developer.android.com/studio/build/gradle-tips.html)* (**recommended**) in your root `/android/build.gradle`, and let the library auto-detect the presence of the following properties: + +```groovy + buildscript {...} + allprojects {...} + + /** + + Project-wide Gradle configuration properties (replace versions as appropriate) + */ + ext { + compileSdkVersion = 25 + targetSdkVersion = 25 + buildToolsVersion = "25.0.2" + supportLibVersion = "25.0.2" + googlePlayServicesVersion = "11.6.2" + androidMapsUtilsVersion = "0.5+" + } +``` + +- Option 2: Use Specific Gradle Config: + +If you do **not** have *project-wide properties* defined or want to use a different Google Play-Services version than the one included in this library (shown above), use the following instead (switch 11.6.2 for the desired version): + +```groovy + ... + dependencies { + ... + compile(project(':react-native-google-places')){ + exclude group: 'com.google.android.gms', module: 'play-services-base' + exclude group: 'com.google.android.gms', module: 'play-services-places' + exclude group: 'com.google.android.gms', module: 'play-services-location' + } + compile 'com.google.android.gms:play-services-base:11.6.2' + compile 'com.google.android.gms:play-services-places:11.6.2' + compile 'com.google.android.gms:play-services-location:11.6.2' + } +``` + - Add the following in your `...MainApplication.java` file: ```java @@ -425,9 +465,9 @@ You have to link dependencies and re-run the build: exclude group: 'com.google.android.gms', module: 'play-services-places' exclude group: 'com.google.android.gms', module: 'play-services-location' } - compile 'com.google.android.gms:play-services-base:10.2.0' - compile 'com.google.android.gms:play-services-places:10.2.0' - compile 'com.google.android.gms:play-services-location:10.2.0' + compile 'com.google.android.gms:play-services-base:11.6.2' + compile 'com.google.android.gms:play-services-places:11.6.2' + compile 'com.google.android.gms:play-services-location:11.6.2' } ``` diff --git a/android/build.gradle b/android/build.gradle index 8b5d1b8..f933701 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,27 +1,45 @@ apply plugin: 'com.android.library' +def DEFAULT_COMPILE_SDK_VERSION = 25 +def DEFAULT_BUILD_TOOLS_VERSION = "25.0.2" +def DEFAULT_TARGET_SDK_VERSION = 25 +def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "11.6.2" +def DEFAULT_ANDROID_MAPS_UTILS_VERSION = "0.5+" + android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION + buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION defaultConfig { minSdkVersion 16 - targetSdkVersion 25 - versionCode 1 - versionName "1.0" + targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } + + packagingOptions { + exclude 'META-INF/LICENSE' + exclude 'META-INF/DEPENDENCIES.txt' + exclude 'META-INF/LICENSE.txt' + exclude 'META-INF/NOTICE.txt' + exclude 'META-INF/NOTICE' + exclude 'META-INF/DEPENDENCIES' + exclude 'META-INF/notice.txt' + exclude 'META-INF/license.txt' + exclude 'META-INF/dependencies.txt' + exclude 'META-INF/LGPL2.1' + } + + lintOptions { + disable 'InvalidPackage' } } dependencies { - compile 'com.facebook.react:react-native:+' - compile 'com.google.android.gms:play-services-base:10.2.4' - compile 'com.google.android.gms:play-services-places:10.2.4' - compile 'com.google.android.gms:play-services-location:10.2.4' - compile 'com.google.maps.android:android-maps-utils:0.3.4' + def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION + def androidMapsUtilsVersion = rootProject.hasProperty('androidMapsUtilsVersion') ? rootProject.androidMapsUtilsVersion : DEFAULT_ANDROID_MAPS_UTILS_VERSION + + provided "com.facebook.react:react-native:+" + compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion" + compile "com.google.android.gms:play-services-places:$googlePlayServicesVersion" + compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion" + compile "com.google.maps.android:android-maps-utils:$androidMapsUtilsVersion" } \ No newline at end of file diff --git a/package.json b/package.json index 07d5b35..7126090 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "iOS/Android Google Places Widgets (Autocomplete, Place Picker) and API Services for React Native Apps", "main": "index.js", "author": "Tolu Olowu (Arttitude 360) ", - "version": "2.4.8", + "version": "2.5.0", "scripts": {}, "repository": { "type": "git",