Closed jeroenbourgois closed 6 years ago
Do you mind posting the build.gradle
you have for react-native-radar
and your android project?
I suggest you go gather data in a long field-test of 1km or more.
@christocracy ? @coolbrow my build.gradle and app/build.gradle below, slightly modified to reduce length. What I left out is just the build stuff that is generated by RN.
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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"
}
// Google now hosts their latest API dependencies on their own maven server.
// React Native will eventually add this to their app template.
maven {
url 'https://maven.google.com'
}
maven {
url "$rootDir/../node_modules/react-native-background-geolocation-android/android/libs"
}
maven {
url "$rootDir/../node_modules/react-native-background-fetch/android/libs"
}
}
}
/**
* Project-wide configuration properties
*/
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.6.0"
}
app/build.grade:
apply plugin: "com.android.application"
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "be.truenorth.ptt"
minSdkVersion 19
targetSdkVersion rootProject.targetSdkVersion
versionCode googleVer
versionName userVer
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
...
}
}
splits {
...
}
buildTypes {
...
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
...
}
}
// react-native-background-geolocation
repositories {
flatDir {
dirs "../../node_modules/react-native-background-geolocation-android/android/libs"
}
}
dependencies {
compile project(':react-native-background-upload')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
//compile 'com.android.support:multidex:1.0.1'
// airbnb maps
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
//compile 'com.google.android.gms:play-services-base:11.+'
//compile 'com.google.android.gms:play-services-maps:11.+'
// \airbnb maps
compile(project(':react-native-onesignal')) {
exclude group: 'com.google.android.gms'
}
compile project(':react-native-background-geolocation-android')
compile project(':react-native-background-fetch')
compile project(':react-native-sentry')
compile(project(':react-native-device-info')) {
exclude group: 'com.google.android.gms'
}
compile project(':react-native-navigation')
compile project(':react-native-i18n')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile "com.facebook.react:react-native:+" // From node_modules
// Override play-services version
compile("com.google.android.gms:play-services-base:11.8.0") {
force = true
}
compile("com.google.android.gms:play-services-maps:11.8.0") {
force = true
}
compile("com.google.android.gms:play-services-gcm:11.8.0") {
force = true
}
compile("com.google.android.gms:play-services-location:11.8.0") {
force = true
}
}
// 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'
}
@jeroenbourgois Radar Labs feels react-native-background-geolocation
is a threat to them.
Thanks @jeroenbourgois, this is really helpful.
There is another build.gradle
in the react-native-radar
module (should be in node_modules
where the other react-native libraries are).
In that file, you may have to explicitly exclude the support library transitive dependency like so:
compile('com.onradar:sdk:1.3.+') {
exclude module: 'support-v4'
}
Or alternatively (and preferred), you can change your project's build.gradle
:
compile(project(':react-native-radar')) {
exclude module: 'support-v4'
}
This way, radar will be using the support library version you already have as a dependency and there shouldn't be any conflicts. Sorry about the conflicts, we're working to ensure this doesn't happen in future releases.
@coolbrow You can improve Radar Labs' integration with others by implementing "Gradle Configuration Properties" instead of hard-coding versions.
See my merged pull-request at react-native-maps
for implementation details.
@christocracy Thanks, great idea! We actually do this internally but haven't changed this project yet. Will be updated very soon!
@coolbrow While I have you here, could you please let the Radar Labs marketing people know the following:
Feature | React Native Background Geolocation |
---|---|
iOS SDK | YES background-geolocation-lt |
Android SDK | YES background-geolocation-lt |
Stop detection | YES motionchange |
@christocracy ah I see :) We are looking into alternatives to your library - which we bought a license for - because the notification on Android is blocking to our client. And while chatting with the Radar people they assured me that there was no tracking mention on Android O and the was accurate tracking none the less. So I want to try it out, but building fails for now. I am also trying a regular fetch with react-native-background-fetch
but I fail to do a HTTP POST from within the headless task, which is the only thing I want to do, send the location to a server somewhere.
@jeroenbourgois Yes, you can do an HTTP POST in react-native-background-fetch
HeadlessTask but you have to await
it, as documented.
Hey @jeroenbourgois, we're happy to help troubleshoot Radar over email at support@radar.io. Closing this issue for now. Thanks!
I cannot get a working build, I get the following error:
I looked around on the net, seems to be related to a new build Android support lib version (?) that was released this month. I tried several solutions but it keeps failing. The most notable solution should be to add this in the
build.gradle
But no success...