Libpomelo2 build Android Dynamic library under Linux Libjpomelo

Source: Internet
Author: User

Reference articles are as follows:

http://nodejs.netease.com/topic/540702e0898634292cd0a588

Https://github.com/NetEase/libpomelo2


Compiling libjpomelo.so took 2 days more time, the data is very few, during a lot of detours, recorded here.

1, the official website download Libpomelo2 source code.

2, prepare the Android NDK 10 package, I Ubuntu is 32 bit, so download is android-ndk32-r10b-linux-x86.tar.bz2.

3, open terminal Terminal, the best root permission. Execution./android-toolchain.sh <ndk-dir>. The ndk-dir here is the NDK extract directory downloaded in the second step. After execution, the Android-toolcahin directory is generated in the Libpomelo root directory with all the header files, library files, and executables required for cross-compilation.

4. Before executing./android-gen.sh, we need to set some environment variables, android-toolchain.sh in the export android_toolchain_dir= $PWD/ Android-toolchain this is at the end of the android-toolchain.sh execution has actually disappeared, or that doesn't work, so we're going to manually set

Vim/etc/profile, added at the end

Export android_toolchain_dir= #PWD/android-toolchain, here the #pwd should be your root directory, which is pointing to the Android-toolcahin directory just generated.

Export path= $ANDROID _toolchain_dir/bin: $PATH

Export Path=/home/wangc/android-ndk-r10b/platforms/android-9/arch-arm/usr/include: $PATH

Export Ar=arm-linux-androideabi-ar
Export CC=ARM-LINUX-ANDROIDEABI-GCC
Export cxx=arm-linux-androideabi-g++
Export link=arm-linux-androideabi-g++
Export Platform=android

Here we will set the environment variables inside the android-gen.sh set up manually again, because in the inside set not to do ...


5. Execute./android-gen.sh, then generate a makefile, and make will generate libjpomelo.so in the Out/default/lib.target directory. There are libpomelo2.a in the Default/obj.target directory. The library file is now finished. Here to look at the following file types, files libjpomelo.so, such as the display platform for the arm ELF, congratulations, OK.


6, Eclipse test. Copy the Test/client.java and Test.java under the root directory to Android engineering, and note the directory structure:


The Testpomelo.java code is as follows:

<span style= "FONT-SIZE:14PX;" >public class Testpomelo extends Activity {@Overrideprotected void onCreate (Bundle savedinstancestate) { Super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_testpomelo); Test.main (null);} @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.testpomelo, menu); return true;}} </span>
little friends, do not run quickly!

Libpomelo2 build Android Dynamic library under Linux Libjpomelo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.