[VTM] dependency library InflateException

146 views
Skip to first unread message

Luis M

unread,
Jun 4, 2018, 1:44:46 PM6/4/18
to mapsforge-dev
I have been using vtm-mapsforge for some time in multiple projects (currently using org.mapsforge:vtm-android:0.9.2) but recently I included a dependency library for Gif images (pl.droidsonroids.gif:android-gif-drawable:1.2.12) that I have been using in other projects into the same project I've been using vtm-mapsforge and then the app crashs with an InflateException pointing to the specific Line in which I have the MapView in my layout. I debugged the application and it crashes specifically in the line in which the MapView class tries to load the system libraries:

private static void init() {
       
System.loadLibrary("vtm-jni");
   
}



I only tested the app in Samsung and HTC devices, in an HTC One m8 the app was good, but in Samsung S7, S8, Note 8 crashes like the description above. I also checked if the libvtm-jni.so lib was present in the installed application data and the result was missing in the Samsung devices and present in the HTC device...

In addition the gif library uses this native lib libpl_droidsonroids_gif.so which is present in HTC and missing in Samsung devices.

Besides the fact that I could change the gif library I would like to understand this problem and how to fix it.

Note: Using org.mapsforge:vtm-android:0.9.2 and pl.droidsonroids.gif:android-gif-drawable:1.2.12 in separated projects works fine.

Thanks in advance.


Emux

unread,
Jun 4, 2018, 2:03:59 PM6/4/18
to mapsfo...@googlegroups.com
When building an apk, are all native libs packaged in it?
(can open it with an archive manager)

Strange behavior, seems Gradle related...

Have you tried playing with abiFilters setting in app build.gradle to specify explicitly which ABI the Gradle should package in the apk?

e.g.
ndk {
    abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}

--
Emux

Luis M

unread,
Jun 4, 2018, 2:51:21 PM6/4/18
to mapsforge-dev
You were right the problem was the difference in the ABI support for each library... VTM-Mapsforge only supports armeabi, armeabi-v7a and x86 while the Gif-Library supports all the ABIs. That's why the app crashes every time in devices with a specific ABI supported by Gif-Library and not supported by vtm-mapsforgelibrary. I just solved the problem as you suggested, by using abiFilters, specifically the abi that vtm-mapsforge supports which are:

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



But what's going to happend if I run the application in a device with 'mips' abi ???

Emux

unread,
Jun 4, 2018, 2:56:45 PM6/4/18
to mapsfo...@googlegroups.com
Which VTM Android module do you use?

Because vtm-android supports all architectures, see Maven artifacts.


> But what's going to happend if I run the application in a device with 'mips' abi ???

Is there any popular mobile device with MIPS or even x86_64 ?

--
Emux

Longri, Andre Höpfner

unread,
Jun 4, 2018, 3:28:41 PM6/4/18
to mapsfo...@googlegroups.com
I can remember me that armeabi and mips not more supported by newer NDK 

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/67c36252-124c-04ac-a8f4-358c2950ed02%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Luis M

unread,
Jun 4, 2018, 4:11:58 PM6/4/18
to mapsforge-dev
This is the kind of mistakes that makes us seems like fools...
Deep inside my gradle configurations I had commented the lines:

//compile 'org.mapsforge:vtm-android:0.9.2:natives-arm64-v8a'
//compile 'org.mapsforge:vtm-android:0.9.2:natives-mips'
//compile 'org.mapsforge:vtm-android:0.9.2:natives-mips64'
//compile 'org.mapsforge:vtm-android:0.9.2:natives-x86_64'

(the ones missing)
and other, in order to improve some tests building time I did some time ago, I could swear that I uncommented it after the test ends but obviously I didn't...

Finally I get into this silly error all by myself...

Anyway thanks for the directions, next time I will check better my project before asking...
Reply all
Reply to author
Forward
0 new messages