首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Ubuntu10.04中SDK、NDK环境的筹建

2013-04-02 
Ubuntu10.04中SDK、NDK环境的搭建1.安装Ubuntu;2.下载并安装JDK本次安装的是jdk-6u23-linux-i586.bin,下载

Ubuntu10.04中SDK、NDK环境的搭建
1.安装Ubuntu;
2.下载并安装JDK
本次安装的是jdk-6u23-linux-i586.bin,下载到要安装的目录下面,
添加运行权限:

package cn.edu.bupt.ben.myjni;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;public class MyJniActivity extends Activity {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);        /* Create a TextView and set its content.         * the text is retrieved by calling a native         * function.         */        TextView  tv = new TextView(this);        tv.setText( stringFromJNI() );        setContentView(tv);    }    /* A native method that is implemented by the     * 'hello-jni' native library, which is packaged     * with this application.     */    public native String  stringFromJNI();    /* This is another native method declaration that is *not*     * implemented by 'hello-jni'. This is simply to show that     * you can declare as many native methods in your Java code     * as you want, their implementation is searched in the     * currently loaded native libraries only the first time     * you call them.     *     * Trying to call this function will result in a     * java.lang.UnsatisfiedLinkError exception !     */    public native String  unimplementedStringFromJNI();    /* this is used to load the 'hello-jni' library on application     * startup. The library has already been unpacked into     * /data/data/com.example.hellojni/lib/libhello-jni.so at     * installation time by the package manager.     */    static {        System.loadLibrary("myjni");    }}


运行之,齐活!

热点排行