Mapbox-gl-native: armeabi is not work on armv7 devices

Created on 17 Feb 2016  路  24Comments  路  Source: mapbox/mapbox-gl-native

For smaller size, We add

ndk {
    abiFilters "armeabi"
}

in My app's build.gradle file, It means always compile armeabi folder, so use armeabi so if on armv7 devices, That's work for all tripartite library.

But when use mapbox, map is empty on armv7 devices if only use armeabi so like above.

I want to know why so lib of armeabi is not work on armv7 devices?

Thank you very much. @bleege

Android build support

Most helpful comment

@bleege I've tried the 4.1.0-SNAPSHOT, it works fine without any trouble. Thank you so much!

All 24 comments

Can you tell us what version of the Mapbox Android SDK that the app is using? Version 3.2.0 ships with support for the following ABI:

  • armeabi
  • armeabi-v7a
  • mips
  • x86
  • x86_64

If you're looking to ship smaller versions of your app's .apk files, I'd recommend exploring different apk-split options that Google makes available in the Gradle build tools.

/cc @mapbox/support

Thank you for your replay, My mapbox android sdk version is 3.1.0, It's already ships with support for the following ABI:

  • armeabi
  • armeabi-v7a
  • mips
  • x86
  • x86_64

My problem is that: why armeabi "so" lib of mapbox is not work on armv7 devices?

"so" of armeabi can also be work on armv7 devices usually, But if i compile armeabi folder of mapbox only, without armeabi-v7 folder by abiFilters "armeabi", The map is blank on armv7 devices.

@Trinea This is my understanding as well, armeabi ABIs should work on armeabi-v7a devices. This could be a performance issue, or a bug with a specific device. Could you tell us which device have you been using to run your tests?

Independently, I'd also like to recommend the solution @bleege mentions above to reduce the size of your SDK. Shipping different APK split by ABI will guarantee that your users will take advantage of newer devices' CPU capabilities.

@zugaldia yes

we only compile armeabi for all devices. It's our project remaining problem, and we have not time to fix it now.

Our appstore does not support apk-split, we donnot use Google Play.

@Trinea thank you for the feedback, this is very useful. Could you point us at the device you're using to reproduce this empty map issue?

ndk {
abiFilters "armeabi"
}
build.gradle like above

on Nexus 5

@Trinea Could you tell us about other dependencies that the app is using? Specifically, are there any other .aar that contain native code (ex: .so).?

Just confirming that the TestApp shows the following crash on a Nexus 5 if we include the filter indicated above:

03-14 17:23:14.458 12684-12684/? I/art: Late-enabling -Xcheck:jni
03-14 17:23:14.513 12684-12684/com.mapbox.mapboxsdk.testapp W/System: ClassLoader referenced unknown path: /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err: java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS (Read-only file system)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:452)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at org.jacoco.agent.rt.internal_773e439.output.FileOutput.openFile(FileOutput.java:67)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at org.jacoco.agent.rt.internal_773e439.output.FileOutput.startup(FileOutput.java:49)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at org.jacoco.agent.rt.internal_773e439.Agent.startup(Agent.java:122)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at org.jacoco.agent.rt.internal_773e439.Agent.getInstance(Agent.java:50)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at org.jacoco.agent.rt.internal_773e439.Offline.<clinit>(Offline.java:31)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at com.mapbox.mapboxsdk.testapp.MapboxApplication.$jacocoInit(MapboxApplication.java)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at com.mapbox.mapboxsdk.testapp.MapboxApplication.<init>(MapboxApplication.java)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at java.lang.Class.newInstance(Native Method)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.Instrumentation.newApplication(Instrumentation.java:996)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.Instrumentation.newApplication(Instrumentation.java:981)
03-14 17:23:14.533 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.ActivityThread.-wrap1(ActivityThread.java)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.os.Looper.loop(Looper.java:148)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err: Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at libcore.io.Posix.open(Native Method)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:438)
03-14 17:23:14.534 12684-12684/com.mapbox.mapboxsdk.testapp W/System.err:   ... 21 more
03-14 17:23:14.548 12684-12704/com.mapbox.mapboxsdk.testapp D/LeakCanary: Could not attempt cleanup, leak storage not writable.
03-14 17:23:14.624 12684-12684/com.mapbox.mapboxsdk.testapp W/LocationServices: Location Permissions Not Granted Yet.  Try again after requesting.
03-14 17:23:14.635 12684-12684/com.mapbox.mapboxsdk.testapp D/AndroidRuntime: Shutting down VM
03-14 17:23:14.636 12684-12684/com.mapbox.mapboxsdk.testapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.mapbox.mapboxsdk.testapp, PID: 12684
                                                                              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mapbox.mapboxsdk.testapp/com.mapbox.mapboxsdk.testapp.MainActivity}: android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class com.mapbox.mapboxsdk.maps.MapView
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                  at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                  at android.os.Looper.loop(Looper.java:148)
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                               Caused by: android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class com.mapbox.mapboxsdk.maps.MapView
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                                                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                                  at com.mapbox.mapboxsdk.testapp.MainActivity.onCreate(MainActivity.java:103)
                                                                                  at android.app.Activity.performCreate(Activity.java:6251)
                                                                                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)聽
                                                                                  at android.app.ActivityThread.-wrap11(ActivityThread.java)聽
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)聽
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                                  at android.os.Looper.loop(Looper.java:148)聽
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)聽
                                                                                  at java.lang.reflect.Method.invoke(Native Method)聽
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)聽
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)聽
                                                                               Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class com.mapbox.mapboxsdk.maps.MapView
                                                                                  at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)聽
                                                                                  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)聽
                                                                                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)聽
                                                                                  at com.mapbox.mapboxsdk.testapp.MainActivity.onCreate(MainActivity.java:103)聽
                                                                                  at android.app.Activity.performCreate(Activity.java:6251)聽
                                                                                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)聽
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)聽
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)聽
                                                                                  at android.app.ActivityThread.-wrap11(ActivityThread.java)聽
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)聽
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                                  at android.os.Looper.loop(Looper.java:148)聽
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)聽
                                                                                  at java.lang.reflect.Method.invoke(Native Method)聽
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)聽
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)聽
                                                                               Caused by: java.lang.reflect.InvocationTargetException
                                                                                  at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                                  at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)聽
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)聽
                                                                                  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)聽
                                                                                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)聽
                                                                                  at com.mapbox.mapboxsdk.testapp.MainActivity.onCreate(MainActivity.java:103)聽
                                                                                  at android.app.Activity.performCreate(Activity.java:6251)聽
                                                                                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)聽
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)聽
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)聽
                                                                                  at android.app.ActivityThread.-wrap11(ActivityThread.java)聽
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)聽
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                                  at android.os.Looper.loop(Looper.java:148)聽
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)聽
                                                                                  at java.lang.reflect.Method.invoke(Native Method)聽
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)聽
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)聽
                                                                               Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mapbox.mapboxsdk.testapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libmapbox-gl.so"
                                                                                  at java.lang.Runtime.loadLibrary(Runtime.java:367)
                                                                                  at java.lang.System.loadLibrary(System.java:1076)
                                                                                  at com.mapbox.mapboxsdk.maps.NativeMapView.<clinit>(NativeMapView.java:44)
                                                                                  at com.mapbox.mapboxsdk.maps.MapView.initialize(MapView.java:193)
                                                                                  at com.mapbox.mapboxsdk.maps.MapView.<init>(MapView.java:157)
                                                                                  at java.lang.reflect.Constructor.newInstance(Native Method)聽
                                                                                  at android.view.LayoutInflater.createView(LayoutInflater.java:619)聽
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)聽
                                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)聽
                                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)聽
                                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)聽
                                                                                  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)聽
                                                                                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)聽
                                                                                  at com.mapbox.mapboxsdk.testapp.MainActivity.onCreate(MainActivity.java:103)聽
                                                                                  at android.app.Activity.performCreate(Activity.java:6251)聽
                                                                                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)聽
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)聽
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)聽
                                                                                  at android.app.ActivityThread.-wrap11(ActivityThread.java)聽
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)聽
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                                  at android.os.Looper.loop(Looper.java:148)聽
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)聽
                                                                                  at java.lang.reflect.Method.invoke(Native Method)聽
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)聽
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)聽

If the filter is changed to abiFilters "armeabi-v7a", everything works as expected.

For reference: Computing Version code in multi-flavor setup.

From the many things I've been trying, upgrading to Android NDK Revision 11c (March 2016) unfortunately won't fix this issue.

It seems to me that the compiler is generating invalid code for the C++14 stuff we use on run_loop.hpp.

@Trinea @tmpsantos After re-reading this ticket, I'm still a bit confused by it's overall direction. Is the goal of this to be able to only ship the armeabi .so with an app and have that single .so run on arm V5, V6, and V7 chips?

@tobrun @lxbarth We need armeabi .so to run on armV7 devices. How to solve this? Pls help!.Thanks!

@bleege @tobrun Because of the app packaging configuration, a developer needs to have armabi .so run on arm V7. They would not be able to change that in short time frame.

@KarenZZhang @xinnong Excellent! Thank you for clarifying the needs. This ticket makes much more sense now. 馃憤

I'll touch base with @tmpsantos on the work that he's started on this already and see what we can do.

Just noting that I've talked with @tmpsantos and he's had some success getting this to work in his local development environment. More technical information will come from him as he's running point on this investigation.

Thank you so much for your kind help! @bleege @tmpsantos @tobrun

I talked with @tmpsantos over the weekend and he said that he's going to pick this up on Monday.

Excellent! Thanks @bleege @tmpsantos

Have a fix for this being tested/reviewed at #5254. I got an armeabi build working on a Nexus 5 (armv7) and Nexus 5x (armv8) with that branch.

This fix has also been cherrypicked on to the release-android-v4.1.0 branch which means that it'll ship with 4.1.0 Final. To help expedite it's availability process I've kicked off a new build to produce a new 4.1.0-SNAPSHOT. It should be available in about 30 minutes.

Great job @tmpsantos!

@bleege How can I get the new build 4.1.0-SNAPSHOT? I can't find it in mavenCentral. Thanks!

@wingwuyf We publish nightly SNAPSHOTS and according the Web site it looks like the latest one is Number 48 from this morning. Please note that SNAPSHOTS aren't on the main mavenCentral() server but on Maven Central's SNAPSHOT server. This means the app's build.gradle will need to add it. Full installation details on how to do this are available on the Mapbox Android SDK Web site.

@bleege I've tried the 4.1.0-SNAPSHOT, it works fine without any trouble. Thank you so much!

@wingwuyf Great to hear that everything is working for you!

Was this page helpful?
0 / 5 - 0 ratings