android ndk different release

ntegrating C++ via the Android NDK.

November 16th, 2009 terence Leave a comment Go to comments

I finally had enough time to look at developing on the Android platform and got my test integration of C++ code with the Android NDK working. The biggest hurdle proved to be familiarity with the Android development environment itself. The following tips apply to NDK 1.6r1:

1) You DO NOT have to have surround your functions with a various extern “C”’s. Unlike what people are saying out there about having to do it you do not have to do it.

2) Check the names of the class to make sure the packages match your JNI interface. (i.e. if your class with the native interfaces are com.examples.HelloWorld…..your JNI class should be Java_com_examples_HelloWorld_<class>

3) Check your android.xml file for the proper package export. When you refactor/rename things in the Eclipse editor it will not update the package export. This will result in Android not being able to find your JNI interface and complain in logcat.

As of 1.6r1, the NDK is something still to play around with and not really ready for production development. That seems to be way the Google Android teams seems to like to run things. Although the OpenGL ES 1.0 libs are available, other supporting libraries are not (i.e. those to load png or jpg’s for texture. The audio libraries). My initial experiments on writing xPhone with Android has a initial platform would prove daunting to say the least.

Categories: Android , C++ , xPhone Tags:

 

  1. January 6th, 2010 at 20:26 | #1

    It would be a dream to be able to build a framework that is able to compile the same code on both platforms (iPhone and Android).

    I wonder if you have watched this video presentation (Link below) by one of the developers of Mytopia, which they build an online social game on multiple platforms such as Facebook, Friendster, Android, iPhone, Symbian and others…

    http://www.crunchbase.com/company/mytopia

    Google just announced Nexus One phone to compete with the iPhone. It would be really interesting this year to see how smartphones progress to be the next generation pocket computers.

Today Android 1.6 NDK, release 1 is available for download from the Android developer site.

To recap, the NDK is a companion to the SDK that provides tools to generate and embed native ARM machine code within your application packages. This native code has the same restrictions as the VM code, but can execute certain operations much more rapidly. This is useful if you’re doing heavy computations, digital processing, or even porting existing code bases written in C or C++.

If you already use the Android 1.5 NDK , upgrading to this release is highly recommended. It provides the following improvements:

  • The ability to use OpenGL ES 1.1 headers and libraries
    If your application targets Android 1.6, your native code can now directly call OpenGL ES 1.1 functions to perform graphics rendering. This will help those programs that need to send large amounts of vertex data to the GPU. Note, however, that activity lifecycle and surface creation must still be performed from the VM. This NDK contains a new sample (“san-angeles”) that shows exactly how to do that with a GLSurfaceView object.
  • The ability to target either Android 1.5 or 1.6 devices
    The NDK parses your project’s properties to know which platform release it is targeting. It will then automatically use the proper headers and libraries to generate your native code. Any application that targets 1.5 will run on Android 1.5, Android 1.6 and any future official system release. Targeting 1.6 should, thus, only be done if your application requires new 1.6 features / APIs, like the ability to call OpenGL ES 1.x headers from native code.
  • The ability to put your native sources under your application’s project tree
    You can now conveniently place all your sources (C, C++ and Java) under the same tree, for editing or version control purposes.
  • Many fixes to the NDK’s build scripts
    The changes to the build scripts fix some annoying bugs and also increase host system compatibility.

If you have any questions, please join us in the Android NDK forum .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值