Last active
December 9, 2018 12:19
-
-
Save dengue8830/a1d44a036cb9b83d3e1f2aefae7a4b3d to your computer and use it in GitHub Desktop.
react-native-background-geolocation + firebase + react-native-maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.android.application" | |
import com.android.build.OutputFile | |
project.ext.react = [ | |
entryFile: "index.js" | |
] | |
apply from: "../../node_modules/react-native/react.gradle" | |
def enableSeparateBuildPerCPUArchitecture = false | |
/** | |
* Run Proguard to shrink the Java bytecode in release builds. | |
*/ | |
def enableProguardInReleaseBuilds = false | |
android { | |
compileSdkVersion rootProject.ext.compileSdkVersion | |
buildToolsVersion rootProject.ext.buildToolsVersion | |
defaultConfig { | |
applicationId "..." | |
minSdkVersion rootProject.ext.minSdkVersion | |
targetSdkVersion rootProject.ext.targetSdkVersion | |
versionCode 1 | |
versionName "1.0" | |
ndk { | |
abiFilters "armeabi-v7a", "x86" | |
} | |
} | |
splits { | |
abi { | |
reset() | |
enable enableSeparateBuildPerCPUArchitecture | |
universalApk false // If true, also generate a universal APK | |
include "armeabi-v7a", "x86" | |
} | |
} | |
signingConfigs { | |
release { | |
... | |
} | |
} | |
buildTypes { | |
release { | |
minifyEnabled enableProguardInReleaseBuilds | |
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | |
signingConfig signingConfigs.release | |
} | |
} | |
// applicationVariants are e.g. debug, release | |
applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
// For each separate APK per architecture, set a unique version code as described here: | |
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits | |
def versionCodes = ["armeabi-v7a":1, "x86":2] | |
def abi = output.getFilter(OutputFile.ABI) | |
if (abi != null) { // null for the universal-debug, universal-release variants | |
output.versionCodeOverride = | |
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode | |
} | |
} | |
} | |
} | |
dependencies { | |
compile project(':react-native-device-info') | |
implementation project(':react-native-exit-app') | |
implementation project(':react-native-firebase') | |
implementation project(':react-native-audio-toolkit') | |
// Excluimos la dependencia para importarla por separado para coexistencia con otros que dependen de playservices | |
// como sugieren aca https://github.com/react-community/react-native-maps/blob/master/docs/installation.md#android | |
implementation(project(':react-native-maps')){ | |
exclude group: 'com.google.android.gms', module: 'play-services-base' | |
exclude group: 'com.google.android.gms', module: 'play-services-maps' | |
} | |
// Importamos play services por separado para que pueda coexistir esta dependencia con | |
// una unica version para firebase y para maps | |
implementation 'com.google.android.gms:play-services-base:16.0.1' | |
implementation 'com.google.android.gms:play-services-maps:16.0.0' | |
// Firebase | |
implementation "com.google.firebase:firebase-core:16.0.4" | |
implementation "com.google.firebase:firebase-messaging:17.3.4" | |
// Ubicacion | |
implementation project(':react-native-mauron85-background-geolocation') | |
// Base | |
implementation fileTree(dir: "libs", include: ["*.jar"]) | |
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" | |
implementation "com.facebook.react:react-native:+" // From node_modules | |
} | |
// Run this once to be able to run the application with BUCK | |
// puts all compile dependencies into folder libs for BUCK to use | |
task copyDownloadableDepsToLibs(type: Copy) { | |
from configurations.compile | |
into 'libs' | |
} | |
apply plugin: 'com.google.gms.google-services' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.2.1' | |
// Para firebase | |
classpath 'com.google.gms:google-services:4.0.1' | |
// NOTE: Do not place your application dependencies here; they belong | |
// in the individual module build.gradle files | |
} | |
} | |
allprojects { | |
repositories { | |
mavenLocal() | |
google() | |
jcenter() | |
maven { | |
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | |
url "$rootDir/../node_modules/react-native/android" | |
} | |
} | |
} | |
// Facebook fix | |
subprojects { | |
afterEvaluate {project -> | |
if (project.hasProperty("android")) { | |
android { | |
compileSdkVersion 27 | |
buildToolsVersion '27.0.3' | |
} | |
} | |
} | |
} | |
ext { | |
buildToolsVersion = "27.0.3" | |
minSdkVersion = 16 | |
compileSdkVersion = 27 | |
targetSdkVersion = 26 | |
supportLibVersion = "27.1.1" | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '4.6' | |
distributionUrl = distributionUrl.replace("bin", "all") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Project-wide Gradle settings. | |
# IDE (e.g. Android Studio) users: | |
# Gradle settings configured through the IDE *will override* | |
# any settings specified in this file. | |
# For more details on how to configure your build environment visit | |
# http://www.gradle.org/docs/current/userguide/build_environment.html | |
# Specifies the JVM arguments used for the daemon process. | |
# The setting is particularly useful for tweaking memory settings. | |
# Default value: -Xmx10248m -XX:MaxPermSize=256m | |
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | |
# When configured, Gradle will run in incubating parallel mode. | |
# This option should only be used with decoupled projects. More details, visit | |
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | |
# org.gradle.parallel=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
distributionBase=GRADLE_USER_HOME | |
distributionPath=wrapper/dists | |
zipStoreBase=GRADLE_USER_HOME | |
zipStorePath=wrapper/dists | |
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "...", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start", | |
"android": "react-native run-android", | |
"ios": "react-native run-ios --simulator='iPhone 6s Plus'", | |
"test": "jest", | |
"tsc": "tsc" | |
}, | |
"dependencies": { | |
"axios": "0.18.0", | |
"formik": "1.3.2", | |
"human-readable-ids": "1.0.4", | |
"moment": "2.22.2", | |
"native-base": "2.8.1", | |
"react": "16.6.1", | |
"react-native": "0.57.5", | |
"react-native-animatable": "1.3.0", | |
"react-native-audio-toolkit": "^1.0.6", | |
"react-native-device-info": "0.24.3", | |
"react-native-dropdownalert": "3.7.1", | |
"react-native-exit-app": "1.0.0", | |
"react-native-firebase": "5.1.1", | |
"react-native-geocoding": "0.3.0", | |
"react-native-loading-spinner-overlay": "1.0.1", | |
"react-native-maps": "0.22.1", | |
"react-native-mauron85-background-geolocation": "0.5.0-alpha.47", | |
"react-native-permissions": "1.1.1", | |
"react-router-native": "4.3.0", | |
"unstated": "2.1.1", | |
"validator": "10.9.0" | |
}, | |
"devDependencies": { | |
"@types/jest": "23.3.9", | |
"@types/node": "10.12.9", | |
"@types/react": "16.7.6", | |
"@types/react-native": "0.57.11", | |
"@types/react-native-permissions": "1.1.1", | |
"@types/react-router-native": "4.2.3", | |
"@types/react-test-renderer": "16.0.3", | |
"@types/validator": "9.4.3", | |
"babel-jest": "23.6.0", | |
"jest": "23.6.0", | |
"metro-react-native-babel-preset": "0.49.2", | |
"react-test-renderer": "16.6.1", | |
"ts-jest": "23.10.4", | |
"typescript": "3.1.6" | |
}, | |
"jest": { | |
"preset": "react-native", | |
"transform": { | |
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js", | |
".+\\.tsx?$": "ts-jest" | |
}, | |
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | |
"moduleFileExtensions": [ | |
"ts", | |
"tsx", | |
"js" | |
], | |
"modulePaths": [ | |
"<rootDir>" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment