radarlabs / react-native-radar

React Native module for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
170 stars 32 forks source link

Build error with Android SDK 28 alpha #14

Closed jeroenbourgois closed 6 years ago

jeroenbourgois commented 6 years ago

I cannot get a working build, I get the following error:

:react-native-radar:processDebugAndroidTestResources
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
    at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
    at sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process /Users/jeroenb/Library/Android/sdk/build-tools/26.0.2/aapt with arguments {package -f --no-crunch -I /Users/jeroenb/Library/Android/sdk/platforms/android-26/android.jar -M /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/manifest/androidTest/debug/AndroidManifest.xml -S /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/res/merged/androidTest/debug -m -J /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/generated/source/r/androidTest/debug -F /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/res/androidTest/debug/resources-debugAndroidTest.ap_ -0 apk --output-text-symbols /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/symbols/androidTest/debug --no-version-vectors}
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
    ... 47 more
Caused by: com.android.ide.common.process.ProcessException: Error while executing process /Users/jeroenb/Library/Android/sdk/build-tools/26.0.2/aapt with arguments {package -f --no-crunch -I /Users/jeroenb/Library/Android/sdk/platforms/android-26/android.jar -M /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/manifest/androidTest/debug/AndroidManifest.xml -S /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/res/merged/androidTest/debug -m -J /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/generated/source/r/androidTest/debug -F /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/res/androidTest/debug/resources-debugAndroidTest.ap_ -0 apk --output-text-symbols /Users/jeroenb/Work/jackjoe/butikk/node_modules/react-native-radar/android/build/intermediates/symbols/androidTest/debug --no-version-vectors}
    at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73)
    at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48)
    at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78)
    at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74)
    at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1237)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911)
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)
    at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)
    at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)
    at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Users/jeroenb/Library/Android/sdk/build-tools/26.0.2/aapt'' finished with non-zero exit value 1
    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:380)
    at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)
    ... 9 more

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

configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:26+'
}

But no success...

russellcullen commented 6 years ago

Do you mind posting the build.gradle you have for react-native-radar and your android project?

christocracy commented 6 years ago

I suggest you go gather data in a long field-test of 1km or more.

jeroenbourgois commented 6 years ago

@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'
}
christocracy commented 6 years ago

@jeroenbourgois Radar Labs feels react-native-background-geolocation is a threat to them.

russellcullen commented 6 years ago

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.

christocracy commented 6 years ago

@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.

russellcullen commented 6 years ago

@christocracy Thanks, great idea! We actually do this internally but haven't changed this project yet. Will be updated very soon!

christocracy commented 6 years ago

@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
jeroenbourgois commented 6 years ago

@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.

christocracy commented 6 years ago

@jeroenbourgois Yes, you can do an HTTP POST in react-native-background-fetch HeadlessTask but you have to await it, as documented.

nickpatrick commented 6 years ago

Hey @jeroenbourgois, we're happy to help troubleshoot Radar over email at support@radar.io. Closing this issue for now. Thanks!