Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

6.0.0-beta.1 crashing at startup time #11125

Closed
Guardiola31337 opened this issue Feb 6, 2018 · 10 comments
Closed

6.0.0-beta.1 crashing at startup time #11125

Guardiola31337 opened this issue Feb 6, 2018 · 10 comments
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release crash

Comments

@Guardiola31337
Copy link
Contributor

When including 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.0-beta.1' in a simple project that only loads a simple map, the app crashes at startup time.

Tested the same scenario using 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.4.0' and it's working fine.

I guess the issue was introduced in #10733
because it’s crashing when trying to load the native library when calling ConnectivityReceiver.instance(appContext)

Logcat

02-06 14:01:02.630 14888-14888/com.pguardiola.uiagesturegen A/libc: /usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed
02-06 14:01:02.630 14888-14888/com.pguardiola.uiagesturegen A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 14888 (a.uiagesturegen)
02-06 14:01:02.735 354-354/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-06 14:01:02.736 354-354/? I/DEBUG: Build fingerprint: 'motorola/victara_reteu/victara:5.0/LXE22.46-19/18:user/release-keys'
02-06 14:01:02.737 354-354/? I/DEBUG: Revision: 'p2bf'
02-06 14:01:02.737 354-354/? I/DEBUG: ABI: 'arm'
02-06 14:01:02.738 354-354/? I/DEBUG: pid: 14888, tid: 14888, name: a.uiagesturegen  >>> com.pguardiola.uiagesturegen <<<
02-06 14:01:02.738 354-354/? I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
02-06 14:01:02.783 354-354/? I/DEBUG: Abort message: '/usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed'
02-06 14:01:02.783 354-354/? I/DEBUG:     r0 00000000  r1 00003a28  r2 00000006  r3 00000000
02-06 14:01:02.783 354-354/? I/DEBUG:     r4 b6f16114  r5 00000006  r6 00000058  r7 0000010c
02-06 14:01:02.783 354-354/? I/DEBUG:     r8 00000000  r9 be88c770  sl be88c760  fp b50f5a5c
02-06 14:01:02.783 354-354/? I/DEBUG:     ip 00003a28  sp be88c060  lr b6eb1681  pc b6ed722c  cpsr 600f0010
02-06 14:01:02.784 354-354/? I/DEBUG: backtrace:
02-06 14:01:02.784 354-354/? I/DEBUG:     #00 pc 0003c22c  /system/lib/libc.so (tgkill+12)
02-06 14:01:02.784 354-354/? I/DEBUG:     #01 pc 0001667d  /system/lib/libc.so (pthread_kill+52)
02-06 14:01:02.785 354-354/? I/DEBUG:     #02 pc 0001728f  /system/lib/libc.so (raise+10)
02-06 14:01:02.785 354-354/? I/DEBUG:     #03 pc 00013ae1  /system/lib/libc.so (__libc_android_abort+36)
02-06 14:01:02.785 354-354/? I/DEBUG:     #04 pc 00012264  /system/lib/libc.so (abort+4)
02-06 14:01:02.785 354-354/? I/DEBUG:     #05 pc 00014dab  /system/lib/libc.so (__libc_fatal+16)
02-06 14:01:02.785 354-354/? I/DEBUG:     #06 pc 00013b65  /system/lib/libc.so (__assert2+20)
02-06 14:01:02.785 354-354/? I/DEBUG:     #07 pc 0035ce4f  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.785 354-354/? I/DEBUG:     #08 pc 0035cf3b  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.785 354-354/? I/DEBUG:     #09 pc 0035b30d  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.786 354-354/? I/DEBUG:     #10 pc 0035ad7d  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.786 354-354/? I/DEBUG:     #11 pc 00017c91  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.786 354-354/? I/DEBUG:     #12 pc 00078c53  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.786 354-354/? I/DEBUG:     #13 pc 00017177  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so
02-06 14:01:02.786 354-354/? I/DEBUG:     #14 pc 00016ec5  /data/app/com.pguardiola.uiagesturegen-1/lib/arm/libmapbox-gl.so (JNI_OnLoad+4)
02-06 14:01:02.786 354-354/? I/DEBUG:     #15 pc 001e6757  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, art::Handle<art::mirror::ClassLoader>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1610)
02-06 14:01:02.786 354-354/? I/DEBUG:     #16 pc 0020e14f  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+534)
02-06 14:01:02.786 354-354/? I/DEBUG:     #17 pc 00077c99  /system/framework/arm/boot.oat

👀 @tobrun @LukasPaczos @osana @cammace @lilykaiser @zugaldia

@Guardiola31337 Guardiola31337 added Android Mapbox Maps SDK for Android crash labels Feb 6, 2018
@Guardiola31337 Guardiola31337 added this to the android-v6.0.0 milestone Feb 6, 2018
@tobrun tobrun added the beta blocker Blocks the next beta release label Feb 6, 2018
@tobrun
Copy link
Member

tobrun commented Feb 6, 2018

This issue wasn't introduced as part of #10733, reverting that commit doesn't resolve the issue. there an issue with the release build in general.

@tobrun
Copy link
Member

tobrun commented Feb 6, 2018

Could you add your build.gradle from com.pguardiola.uiagesturegen?

@Guardiola31337
Copy link
Contributor Author

@tobrun

buildscript {
    ext.kotlinVersion = '1.1.2-4'

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

repositories {
    mavenCentral()
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.pguardiola.uiagesturegen"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        androidTest.java.srcDirs += 'src/androidTest/kotlin'
        main.java.srcDirs += 'src/main/kotlin'
        test.java.srcDirs += 'src/test/kotlin'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.4.0'

    compile 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.0-beta.1'
    testCompile 'junit:junit:4.12'
}

@tobrun
Copy link
Member

tobrun commented Feb 7, 2018

The crash itself indicates that it's not able to find the geojson classes when starting, changing the deps config to something as:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.0-beta.1@aar'
    implementation "com.mapbox.mapboxsdk:mapbox-android-telemetry:2.2.9@aar"
    implementation "com.mapbox.mapboxsdk:mapbox-java-geojson:2.2.9@jar"
    implementation "com.mapbox.mapboxsdk:mapbox-java-core:2.2.9@jar"
    implementation "com.squareup.okhttp3:okhttp:3.9.1"
    implementation "com.google.code.gson:gson:2.8.0"
    implementation "com.jakewharton.timber:timber:4.5.1"
}

can be used as temporary workaround, I'm currently looking into why the dependencies from the maps sdk aren't available in downstream projects. This issue stems from the new Gradle 3.0.0 plugin with the introduction of the api/implementation keywords.

@tobrun
Copy link
Member

tobrun commented Feb 7, 2018

Figured out the issue, see this SO post for more info but it boils down that the publish to maven requires some rework for gradle 3.0.0. Seeing that Chris Banes repo hasn't been updated in 4 years we will need to move to a more maintained one as android-maven-gradle-plugin.

@LukasPaczos
Copy link
Member

After trying to implement android-maven-gradle-plugin as suggested, I was able to force proper compile/runtime dependency structure as you can see in this POM file (the old one for comparison), but I'm running into leaking dependencies issue, as they are still available to the user despite the runtime tag.
This didn't solve the issue anyway.

Another thing that I noticed is that required dependency set to run 6.0.0-SNAPSHOT is:

implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.0-SNAPSHOT'
implementation 'com.mapbox.mapboxsdk:mapbox-java-core:2.2.9'
implementation 'com.google.code.gson:gson:2.8.0'

Both of the missing dependencies should've been taken from com.mapbox.mapboxsdk:mapbox-java-geojson:2.2.9 where they are declared as compile, seen here. We are depending on it with api here which should be an equivalent to compile, so I'm having troubles pinpointing the issue.

@Guardiola31337
Copy link
Contributor Author

After digging into this found that there's some kind of conflict when including transitive dependencies which use different versions of Gradle. That's why updating Gradle in MAS 2.x (mapbox/mapbox-java#716) so that it uses the same version fixes the issue. Also confirmed that #10920 solved OP because MAS 3.0 uses the same Gradle version. So no need for switching plugins.

During the process, also found that MAS 3.0 is leaking some unnecessary dependencies to the end users and we should fix it.

@Guardiola31337
Copy link
Contributor Author

I've just tested using the latest 6.0.0-SNAPSHOT (which includes #10920 and it should have fixed OP) and it's still crashing 😖

@Guardiola31337
Copy link
Contributor Author

#11161 solved OP.
I also checked that #11161 solved the issue previous to MAS 3.0 (using different Gradle versions) meaning that wasn’t any conflict and it was because transitive dependencies weren’t exposed correctly.

@Guardiola31337
Copy link
Contributor Author

When solving OP found and reported a couple of issues 👀
mapbox/mapbox-java#717
#11166

Also #11165 cherry picks #11161 into master.

We're good here. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release crash
Projects
None yet
Development

No branches or pull requests

3 participants