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

The test application won't compile with the given dependencies #13353

Closed
albintornqvist opened this issue Nov 13, 2018 · 6 comments
Closed

The test application won't compile with the given dependencies #13353

albintornqvist opened this issue Nov 13, 2018 · 6 comments

Comments

@albintornqvist
Copy link

After following the steps in the readme of the Android project i can't seem to get the project to build properly. The readme suggests using the latest version of NDK but after some digging i found out that I have to use version 17 of NDK to be able to compile. (Maybe the readme should specify the version?). When using NDK 17 compilation goes further but i still get an error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':MapboxGLAndroidSDK:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/armeabi-v7a/libmapbox-gl.so'"

I tried adding the following to get rid of this error:

android {
    packagingOptions {
        pickFirst 'lib/armeabi-v7a/libmapbox-gl.so'
    }
}

This makes the project compile but the test app crashes as soon as i run it on the emulator (using a Pixel 2 XL on API 26 emulator).
Crash log:

2018-11-13 13:44:08.904 19864-19864/com.mapbox.mapboxsdk.testapp A/libc: /Volumes/Android/buildbot/src/android/ndk-r12-release/ndk/sources/cxx-stl/llvm-libc++abi/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, ...): assertion "terminating with uncaught exception of type jni::PendingJavaException" failed
2018-11-13 13:44:08.904 19864-19864/com.mapbox.mapboxsdk.testapp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 19864 (pboxsdk.testapp)

Am I missing something here? Some dependency version not specified in the readme? Does anyone recognize the issue?

Steps to reproduce

  1. Checkout the tag android-v6.6.7 or android-v6.0.1 and use NDK 16 (not sure if correct version)
  2. Setup all the dependencies and follow the steps described in the readme.
  3. Build the test application MapboxGLAndroidSDKTestApp for device or emulator (or run 'make apackage' which also produces the compilation error)

Expected behavior

The project compiles and the app runs on the device/emulator.

Actual behavior

Build error or crash.

Configuration

Android versions: Android 8.0, API 26
Device models: Samsung SM-G955F or Emulator: Pixel XL 2
Mapbox SDK versions: 6.0.1 or 6.6.7
Android Studio version: 3.2.1
OS version: MacOS Mojave 10.14

screenshot 2018-11-13 at 14 01 54

@kkaefer
Copy link
Member

kkaefer commented Nov 13, 2018

Sorry, NDK r18 is currently blocked on the removal of <experimental/optional> in the libc++ used by NDK r18 (#13049).

We haven't seen multiple versions of libmapbox-gl.so being produced; that looks like a bug. Did you try clearing the build directory after you downgraded the NDK? You can run make clean to do that.

/Volumes/Android/buildbot/src/android/ndk-r12-release points to a really old NDK version. Please use a newer version. We're currently successfully using r17b.

@albintornqvist
Copy link
Author

Ah, I'll keep my eyes on #13049 then!

I tried 'make clean' and also clean build folder in Android Studio.
I'm not sure why the stack trace points to a ndk-r12-release (could it be a dependent lib that is built with r12?...) since I'm sure I installed NDK r17c. As you can see in the screenshot i provided, Android Studio seems to have picked up that version as well. However r17c is the only version of r17 that I can find, looking at https://developer.android.com/ndk/downloads/older_releases and spending some time googling... Have you tried this version as well? or do you know how to get a hold of r17b?

@albintornqvist
Copy link
Author

albintornqvist commented Nov 14, 2018

I found a version of r17b after some searching but I am experiencing the same issue with that version as well unfortunately (can not compile due to more than one file called libmapbox-gl.so).
I successfully compiled from tag android-v5.5.0 using NDK r16b. But i still get the same crash when running the test app. Stepping through the startup process of the app it seems like the instantiation of NativeConntectivityListener is causing the crash. When crashing, the app stops on a breakpoint producing the following stack trace in Android Studio:

tgkill 0x0000007921ed2844
abort 0x0000007921e7f05c
___lldb_unnamed_symbol9525$$libmapbox-gl.so 0x000000790001f5c8
___lldb_unnamed_symbol9526$$libmapbox-gl.so 0x000000790001f6f0
___lldb_unnamed_symbol9485$$libmapbox-gl.so 0x000000790001cec8
__cxa_throw 0x000000790001c56c
___lldb_unnamed_symbol301$$libmapbox-gl.so 0x00000078ffcc3710
___lldb_unnamed_symbol300$$libmapbox-gl.so 0x00000078ffcc3534
JNI_OnLoad 0x00000078ffd12b74
art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, _jstring*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) 0x000000791d245d68
JVM_NativeLoad 0x0000007913444398
nativeLoad 0x0000000071e034c8
art_quick_invoke_static_stub 0x000000791d48b23c
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x000000791d0356e8
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1ee724
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d34
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d214404
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20e5d4
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)1, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d212ed4
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20ccec
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d211738
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20cc80
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d214404
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20e5d4
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d214404
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20e5d4
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
artQuickToInterpreterBridge 0x000000791d4662a0
art_quick_to_interpreter_bridge 0x000000791d494420
art_quick_invoke_static_stub 0x000000791d48b23c
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x000000791d0356e8
art::ClassLinker::InitializeClass(art::Thread*, art::Handle<art::mirror::Class>, bool, bool) 0x000000791d095744
art::ClassLinker::EnsureInitialized(art::Thread*, art::Handle<art::mirror::Class>, bool, bool) 0x000000791d07e660
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d209370
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d214404
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20e5d4
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d214404
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20e5d4
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d211738
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20cc80
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d211738
art::JValue art::interpreter::ExecuteSwitchImpl<false, false>(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d20cc80
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8f38
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
MterpInvokeDirect 0x000000791d4739bc
ExecuteMterpImpl 0x000000791d47ca98
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
MterpInvokeStatic 0x000000791d473c78
ExecuteMterpImpl 0x000000791d47cb18
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
MterpInvokeVirtual 0x000000791d472628
ExecuteMterpImpl 0x000000791d47c998
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
MterpInvokeVirtual 0x000000791d472628
ExecuteMterpImpl 0x000000791d47c998
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1cf798
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d14
MterpInvokeStatic 0x000000791d473c78
ExecuteMterpImpl 0x000000791d47cb18
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
artQuickToInterpreterBridge 0x000000791d4662a0
art_quick_to_interpreter_bridge 0x000000791d494420
art_quick_invoke_static_stub 0x000000791d48b23c
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x000000791d0356e8
art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*) 0x000000791d3ac25c
art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long) 0x000000791d3ae000
art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobject*) 0x000000791d331f78
invoke 0x0000000071de2f68
art_quick_invoke_stub 0x000000791d48af88
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x000000791d0356ac
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*) 0x000000791d1ee724
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x000000791d1e8d34
MterpInvokeVirtual 0x000000791d472628
ExecuteMterpImpl 0x000000791d47c998
art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) 0x000000791d1c8ed4
artQuickToInterpreterBridge 0x000000791d4662a0
art_quick_to_interpreter_bridge 0x000000791d494420
main 0x0000000074280a2c
art_quick_invoke_static_stub 0x000000791d48b23c
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x000000791d0356e8
art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*) 0x000000791d3ac25c
art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list) 0x000000791d3abdcc
art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list) 0x000000791d2b80d8
___lldb_unnamed_symbol274$$libandroid_runtime.so 0x000000791e841088
android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool) 0x000000791e843384
___lldb_unnamed_symbol2$$app_process64 0x0000005dce2215d8
__libc_init 0x0000007921e7c980
___lldb_unnamed_symbol1$$app_process64 0x0000005dce220ecc
__dl__start 0x000000792299999c

@tobrun
Copy link
Member

tobrun commented Nov 14, 2018

@albintornqvist your setup matches my setup locally.

More than one file was found with OS independent path 'lib/armeabi-v7a/libmapbox-gl.so'"

Can you execute a make clean in the root folder of this project to clear out any remaining artifacts? What happens if you execute make android? You mention using ndk 17, but stacktrace in OP indicates ndk 12 for some reason in /Volumes/Android/buildbot/src/android/ndk-r12-release/.

@albintornqvist
Copy link
Author

The ndk 12-stacktrace sure is suspicious. I tried cloning the Mapbox repo fresh in a new folder and now it works like a charm. I should have tried that earlier of course... I'm guessing I had old compiled files somewhere in my previous local repo that wasn't deleted when running make clean.

Thank you for taking the time to answer my questions and pinpointing the problem!

@kkaefer
Copy link
Member

kkaefer commented Nov 14, 2018

Glad it works for you now!

@kkaefer kkaefer closed this as completed Nov 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants