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

Crashing on Android 7.0 #869

Closed
lucasbento opened this issue Dec 13, 2017 · 12 comments
Closed

Crashing on Android 7.0 #869

lucasbento opened this issue Dec 13, 2017 · 12 comments

Comments

@lucasbento
Copy link
Contributor

I'm trying to run the library on an Android device, it crashes as soon as I reach a view using <MapView /> and after that the app doesn't open and crashes as soon as I try to open it.

Initial crash:

12-13 16:31:15.575 17221 17221 E AndroidRuntime: FATAL EXCEPTION: main
12-13 16:31:15.575 17221 17221 E AndroidRuntime: Process: com.myApp.app, PID: 17221
12-13 16:31:15.575 17221 17221 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "boolean com.google.android.gms.common.api.Api$zze.zzaax()"
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.<init>(GoogleLocationEngine.java:38)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.getLocationEngine(GoogleLocationEngine.java:43)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngineFactory.supply(GoogleLocationEngineFactory.java:17)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.LocationEngineProvider.initAvailableLocationEngines(LocationEngineProvider.java:44)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.LocationEngineProvider.<init>(LocationEngineProvider.java:23)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.registerLocationUpdates(MapboxTelemetry.java:481)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.access$200(MapboxTelemetry.java:56)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry$3.run(MapboxTelemetry.java:465)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:751)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:154)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6123)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-13 16:31:15.575 17221 17221 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
12-13 16:31:15.576 17221 19383 I Bugsnag : Sending 1 saved error(s) to Bugsnag
12-13 16:31:15.581  1137  6312 W ActivityManager:   Force finishing activity com.myApp.app/.MainActivity

All the other crashes:

12-13 15:32:43.328 27520 27520 V AndroidLocationEngine: Initializing.
12-13 15:32:43.366 27520 27520 D AndroidRuntime: Shutting down VM
12-13 15:32:43.458 27520 27520 I Bugsnag : Saved unsent error to disk (/data/user/0/com.myApp.app/cache/bugsnag-errors/1513175563377_startupcrash.json) 
12-13 15:32:43.459 27520 27586 I Bugsnag : Sending 1 saved error(s) to Bugsnag
12-13 15:32:43.459 27520 27520 E AndroidRuntime: FATAL EXCEPTION: main
12-13 15:32:43.459 27520 27520 E AndroidRuntime: Process: com.myApp.app, PID: 27520
12-13 15:32:43.459 27520 27520 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "boolean com.google.android.gms.common.api.Api$zze.zzaax()"
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.<init>(GoogleLocationEngine.java:38)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.getLocationEngine(GoogleLocationEngine.java:43)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.GoogleLocationEngineFactory.supply(GoogleLocationEngineFactory.java:17)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.LocationEngineProvider.initAvailableLocationEngines(LocationEngineProvider.java:44)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.location.LocationEngineProvider.<init>(LocationEngineProvider.java:23)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.registerLocationUpdates(MapboxTelemetry.java:481)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.setTelemetryEnabled(MapboxTelemetry.java:426)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.loadUserPreferences(MapboxTelemetry.java:396)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.initialize(MapboxTelemetry.java:178)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.services.android.telemetry.MapboxTelemetry.initialize(MapboxTelemetry.java:125)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:55)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.mapbox.rctmgl.modules.RCTMGLModule$1.run(RCTMGLModule.java:245)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:751)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:154)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6123)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-13 15:32:43.459 27520 27520 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
12-13 15:32:43.462  1137  6415 W ActivityManager:   Force finishing activity com.myApp.app/.MainActivity

Versions

react-native: 0.49.3
react-native-mapbox-gl: 6.0.1
Android: 7.0
Device: Moto X

@nitaliano
Copy link
Owner

Is this happening on master?

@lucasbento
Copy link
Contributor Author

@nitaliano: not sure if the commits are the same but I am using the same version as stated on current package.json.

@nitaliano
Copy link
Owner

Master contains the newest Mapbox iOS and Android SDK, which could have potentially fixed this issue

@lucasbento
Copy link
Contributor Author

@nitaliano: installed from master from commit f3b8c8f, still the same thing:

12-14 09:48:24.297 30915 30915 E AndroidRuntime: FATAL EXCEPTION: main
12-14 09:48:24.297 30915 30915 E AndroidRuntime: Process: com.horsha.app, PID: 30915
12-14 09:48:24.297 30915 30915 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "boolean com.google.android.gms.common.api.Api$zze.zzaax()"
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.<init>(GoogleLocationEngine.java:38)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.services.android.telemetry.location.GoogleLocationEngine.getLocationEngine(GoogleLocationEngine.java:43)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.services.android.telemetry.location.GoogleLocationEngineFactory.supply(GoogleLocationEngineFactory.java:17)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.services.android.telemetry.location.LocationEngineProvider.initAvailableLocationEngines(LocationEngineProvider.java:44)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.services.android.telemetry.location.LocationEngineProvider.<init>(LocationEngineProvider.java:23)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:54)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.mapbox.rctmgl.modules.RCTMGLModule$1.run(RCTMGLModule.java:268)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6123)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-14 09:48:24.297 30915 30915 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
12-14 09:48:24.299  1137  6418 W ActivityManager:   Force finishing activity com.horsha.app/.MainActivity

@nitaliano
Copy link
Owner

@lucasbento does your app also bring in google play services?

@lucasbento
Copy link
Contributor Author

lucasbento commented Dec 18, 2017

@nitaliano: I'm not sure, this is my entire ./android/app/build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile
import groovy.json.JsonSlurper

def getNpmVersion() {
    def inputFile = new File("../package.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)
    return packageJson["version"]
}

def getGitVersion() {
    def process = "git rev-list develop --first-parent --count".execute()
    return process.text.toInteger()
}

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

/**
 * Versioning
 */
def userVersion = getNpmVersion()
def googleVersion = getGitVersion()

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.horsha.app"
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled true

        versionCode googleVersion
        versionName userVersion

        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }

    dexOptions {
        jumboMode true
        javaMaxHeapSize "4g"
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }

    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(':yfuks-react-native-action-sheet')
    compile project(':bugsnag-react-native')
    compile project(':mapbox-react-native-mapbox-gl')
    compile project(':react-native-prompt-android')
    compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
    compile project(':react-native-svg')
    compile project(':react-native-background-geolocation')
    compile project(':react-native-version-number')
    compile project(':react-native-camera')
    compile project(':react-native-image-resizer')
    compile project(':react-native-fs')
    compile project(':react-native-document-picker')
    compile project(':react-native-photo-view')
    compile project(':react-native-photo-view')
    compile project(':react-native-fbsdk')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile(name: 'tslocationmanager', ext: 'aar')
    compile 'com.facebook.react:react-native:+'
    // compile 'com.facebook.fresco:animated-gif:1.0.1'
    compile 'com.android.support:multidex:1.0.1'
}

repositories {
    flatDir {
       dirs "../../node_modules/react-native-background-geolocation/android/libs"
    }
}

// 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'

@lucasbento
Copy link
Contributor Author

@nitaliano: do you have any hint of what is going on?

@nitaliano
Copy link
Owner

The Android SDK also uses google play services what happens if you add

compile 'com.google.android.gms:play-services-location:11.6.2'

to your gradle file?

@lucasbento
Copy link
Contributor Author

@nitaliano: thanks for replying.

This is what I get by adding that line:

image

@nitaliano
Copy link
Owner

nitaliano commented Dec 20, 2017

@lucasbento I've run the codebase with Android 7 on hardware and haven't seen a crash. Which leads me to believe that multiple deps are bringing in google play services and the versions are messing with each other. I found this issue in react-native-maps react-native-maps/react-native-maps#1408 it looks similar. Also found this issue in this repo #814

@lucasbento
Copy link
Contributor Author

lucasbento commented Dec 21, 2017

@nitaliano: already tried the first one, will try #814 and it again, will let you know whether it works or not, thanks!

@lucasbento
Copy link
Contributor Author

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

No branches or pull requests

2 participants