Native library is not working

1,013 views
Skip to first unread message

Charalambos Xinaris

unread,
Nov 25, 2013, 3:52:55 AM11/25/13
to osm...@googlegroups.com
I need some help in setting up the development environment. I am trying for many hours to figure out the right steps and I need some help.

1. I followed the instructions in https://code.google.com/p/osmand/wiki/InstallDevelopmentEnvironment and use egit in eclpise to download the OsmAnd. Now in the Eclipse environment I have the projects Osmand, Osmand-AddressPlugin, OsmAnd-java, Osmand-ParkingPlugin, Osmand-SRTMPlugin and SherlockBar.

2. Everything compile fine in Eclipse. I had to download also OsmAnd-resources and use ant copy_resources.

3. I downloaded pre-build native libraries from http://download.osmand.net/resource/jni-prebuilt.zip, extract the content and add the four folders armeabi, armeabi-v7a, mips, x86 and add them to the OmsAnd/libs folder.

3. I build and run the project from Eclipse and it successfully installed on phone, the app it's opening fine but I cannot enable native library. Do I need to do something else with ant to be able to install the app with the native library. Pre-build native libraries are not enough?

I can see in logcat multiple issues. Can you help?

11-25 10:21:55.454: D/net.osmand(4031): NativeOsmandLibrary Loading native gnustl_shared...
11-25 10:21:55.454: D/dalvikvm(4031): Trying to load lib /data/data/net.osmand.plus/lib/libgnustl_shared.so 0x4213aaa0
11-25 10:21:55.459: D/dalvikvm(4031): Added shared lib /data/data/net.osmand.plus/lib/libgnustl_shared.so 0x4213aaa0
11-25 10:21:55.459: D/dalvikvm(4031): No JNI_OnLoad found in /data/data/net.osmand.plus/lib/libgnustl_shared.so 0x4213aaa0, skipping init
11-25 10:21:55.459: D/net.osmand(4031): NativeOsmandLibrary Loading native cpufeatures_proxy...
11-25 10:21:55.459: D/dalvikvm(4031): Trying to load lib /data/data/net.osmand.plus/lib/libcpufeatures_proxy.so 0x4213aaa0
11-25 10:21:55.459: D/dalvikvm(4031): Added shared lib /data/data/net.osmand.plus/lib/libcpufeatures_proxy.so 0x4213aaa0
11-25 10:21:55.459: D/dalvikvm(4031): No JNI_OnLoad found in /data/data/net.osmand.plus/lib/libcpufeatures_proxy.so 0x4213aaa0, skipping init
11-25 10:21:55.459: D/net.osmand(4031): NativeOsmandLibrary Loading jnigraphics, since Android >= 2.2 ...
11-25 10:21:55.459: D/dalvikvm(4031): No JNI_OnLoad found in /system/lib/libjnigraphics.so 0x4213aaa0, skipping init
11-25 10:21:55.459: D/net.osmand(4031): NativeOsmandLibrary Loading native libraries...
11-25 10:21:55.464: E/net.osmand(4031): NativeOsmandLibrary Failed to load new native library
11-25 10:21:55.464: E/net.osmand(4031): java.lang.UnsatisfiedLinkError: Couldn't load OsmAndJNI_neon: findLibrary returned null
11-25 10:21:55.464: E/net.osmand(4031): at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-25 10:21:55.464: E/net.osmand(4031): at java.lang.System.loadLibrary(System.java:535)
11-25 10:21:55.464: E/net.osmand(4031): at net.osmand.plus.render.NativeOsmandLibrary.loadNewCore(NativeOsmandLibrary.java:85)
11-25 10:21:55.464: E/net.osmand(4031): at net.osmand.plus.render.NativeOsmandLibrary.getLibrary(NativeOsmandLibrary.java:49)
11-25 10:21:55.464: E/net.osmand(4031): at net.osmand.plus.OsmandApplication.startApplicationBackground(OsmandApplication.java:498)
11-25 10:21:55.464: E/net.osmand(4031): at net.osmand.plus.OsmandApplication.access$3(OsmandApplication.java:485)
11-25 10:21:55.464: E/net.osmand(4031): at net.osmand.plus.OsmandApplication$6.run(OsmandApplication.java:476)
11-25 10:21:55.464: E/net.osmand(4031): at java.lang.Thread.run(Thread.java:856)
11-25 10:21:55.464: D/dalvikvm(4031): Trying to load lib /data/data/net.osmand.plus/lib/libosmand_neon.so 0x4213aaa0
11-25 10:21:55.469: D/dalvikvm(4031): Added shared lib /data/data/net.osmand.plus/lib/libosmand_neon.so 0x4213aaa0
11-25 10:21:55.469: E/net.osmand:native(4031): Failed to find class net/osmand/plus/Reshaper
11-25 10:21:55.469: E/dalvikvm(4031): Fatal error: Failed to find class net/osmand/plus/Reshaper
11-25 10:21:55.469: E/dalvikvm(4031): VM aborting
11-25 10:21:55.469: A/libc(4031): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 4096 (Initializing ap)

Thank you,
Charalambos

Charalambos Xinaris

unread,
Nov 26, 2013, 9:27:38 AM11/26/13
to osm...@googlegroups.com
Anyone that can help on this?

Harry van der Wolf

unread,
Nov 26, 2013, 9:56:45 AM11/26/13
to osmand
Are you really sure that everything compiled fine?
I don't use Eclipse. I compile directly from the command line using ant. Some time ago there were issues with the native library, but as it is an external C++ library that external compilation part went wrong, but OsmAnd it self compiled fine. It simply didn't link the native library during compilation as it wasn't available.
There is a compilation setting for OsmAnd being  "-Dnativeoff=false" and  "-Dnativeoff=true".
If you use the second option do you still get an error free build?

Harry



2013/11/26 Charalambos Xinaris <xin...@gmail.com>
Anyone that can help on this?

--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Harry van der Wolf

unread,
Nov 26, 2013, 10:04:13 AM11/26/13
to osmand
Sorry.
The parameter is really confusing.
I meant if you use "-Dnativeoff=false", thereby forcing to link to the native library, do you still get an error free build?

(the parameter is now a double negative creating a positive. It should be something like -Dlinknative=true/false. Maybe I file a pull request)

Harry


Charalambos Xinaris

unread,
Nov 27, 2013, 1:44:01 AM11/27/13
to osm...@googlegroups.com
Thanks for the response Harry.

Where can I find this compilation parameter to check it's value? I already file-search all the files but I couldn't find it.
As far I understood with Eclipse it cannot compiled with native libraries or I just missing something?

So I am going to start using ant (newbie) with linux because on Windows I can see errors doing a simple ant debug.

Thanks

Charalambos Xinaris

unread,
Nov 30, 2013, 4:25:50 PM11/30/13
to osm...@googlegroups.com
I spent a lot of days looking and learning stuff on this.

I managed to get ant working under cygwin on Windows 7 and even install everything on Ubuntu just to make sure it's not OS related.
Both of the times the result is the same.
- I placed the pre-build libraries (4 directories) inside the OsmAnd/libs directory.
- I run ant debug -Dsdk.dir=path_to_sdk and the build is successful
- The I run ant installd to install the debug application. I tried it on two devices (Samsung S3, Samsung Note ||) and in both of them the app it's crashing at first, the second time it's opening with native libraries off (running in safe mode). 

So I am in a dead end on how to make this to work. I tried to run ndk-build to create again the libraries but it's failing on a command that needs files from OsmAnd-java/c-src and this directory is empty where it's supposed not to be.

Anyone that might have an idea what is going on?

Thanks

Harry van der Wolf

unread,
Nov 30, 2013, 4:53:51 PM11/30/13
to osmand
Then why do you use the prebuilt libraries?
I never do that and they are automatically compiled. The first time it takes much longer to compile of course, but once they are compiled only Osmand gets compiled on new repo syncs and that takes 5 minutes tops.

Harry


2013/11/30 Charalambos Xinaris <xin...@gmail.com>

Chernyshov Yuriy

unread,
Oct 2, 2014, 6:12:34 AM10/2/14
to osm...@googlegroups.com
Hello Harry.

My name is Yuriy and I recently start to discover OsmAnd project.
I use Android Studio and gradle build under Linux OS.
I checkout Git OsmAnd and OsmAnd-core.
I am able to set up and run Android application from the OsmAnd src folder, however I faced with a problem that it is impossible to compile native libraries, I use any ./ndk-build.sh files without any luck.
One of the reason is that next paths does not exists:
"$SCRIPT_LOC/../../OsmAnd-core/externals/configure.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]}
"$SCRIPT_LOC/../../OsmAnd-core/externals/build.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]}
"$SCRIPT_LOC/../OsmAnd-java/generate-swig.sh" 
I was ably to compile only libcpufeatures_proxy.so and libgnustl_shared.so files.
And this is a reason why I use jni-prebuilt files as Charalambos does. And face with the same problem - application crushes at start up.

Now, I would be very appreciate if You point to the documentation or describe how to compile *.so files from command line for the Android project.

Thanks a lot in advance,

Yuriy

понедельник, 25 ноября 2013 г., 10:52:55 UTC+2 пользователь Charalambos Xinaris написал:

Harry van der Wolf

unread,
Oct 2, 2014, 6:59:10 AM10/2/14
to osmand
I don't know how to only compile the .so files. It is somewhere in the scripts.
Another point is that you mention ./ndk-build.sh, but you should use old-ndk-build.sh. The other one does not function correctly and doesn't build the native library.

Did you read https://code.google.com/p/osmand/wiki/CommandLineBuildEnvironment?

Harry



--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chernyshov Yuriy

unread,
Oct 2, 2014, 7:26:52 AM10/2/14
to osm...@googlegroups.com
Yes, I read that page and I did also ./old-ndk-build.sh
This command provides me with libcpufeatures_proxy.so and libgnustl_shared.so files, but not with libosmand.so file and I am wonder how to get it compiled?

Also old-ndk-build.sh generates:
./old-ndk-build.sh: line 24: /home/user/Development/GIT/Osmand/OsmAnd/../../core/externals/configure.sh: No such file or directory

Another point is that I dont use ant and eclipse, I use AndroidStudio and import project to this IDEA.
Everything is going fine up to now, except libosmand.so file ...

Chernyshov Yuriy

unread,
Oct 2, 2014, 9:25:32 AM10/2/14
to osm...@googlegroups.com
I found the way to obtain correct native libraries.
I download http://download.osmand.net/latest-night-build/OsmAnd-default.apk and extract their from the libs folder. 
Reply all
Reply to author
Forward
0 new messages