1.Android NDK Jni å¼åCåC++çåºå«
2.Android JNI/NDK环境的源码配置与Demo编译
3.å®åjniå¼åï¼
4.å¦ä½å¨Androidä¸ä½¿ç¨JNI
Android NDK Jni å¼åCåC++çåºå«
Android NDK Jni å¼åCåC++çåºå«
JNIæ¯Java Native Interfaceç缩åï¼ä¸æ为JAVAæ¬å°è°ç¨ãä»Java1.1å¼å§ï¼Java Native Interface(JNI)æ åæ为javaå¹³å°çä¸é¨åï¼å®å 许Java代ç åå ¶ä»è¯è¨åç代ç è¿è¡äº¤äºãJNIä¸å¼å§æ¯ä¸ºäºæ¬å°å·²ç¼è¯è¯è¨ï¼å°¤å ¶æ¯CåC++è设计çï¼ä½æ¯å®å¹¶ä¸å¦¨ç¢ä½ 使ç¨å ¶ä»è¯è¨ï¼åªè¦è°ç¨çº¦å®åæ¯æå°±å¯ä»¥äºã使ç¨javaä¸æ¬å°å·²ç¼è¯ç代ç 交äºï¼é常ä¼ä¸§å¤±å¹³å°å¯ç§»æ¤æ§ãä½æ¯ï¼æäºæ åµä¸è¿æ ·åæ¯å¯ä»¥æ¥åçï¼çè³æ¯å¿ é¡»çï¼æ¯å¦ï¼ä½¿ç¨ä¸äºæ§çåºï¼ä¸ç¡¬ä»¶ãæä½ç³»ç»è¿è¡äº¤äºï¼æè 为äºæé«ç¨åºçæ§è½ãJNIæ åè³å°ä¿è¯æ¬å°ä»£ç è½å·¥ä½å¨ä»»ä½Java èææºå®ç°ä¸ã æ åçjavaç±»åºå¯è½ä¸æ¯æä½ çç¨åºæéçç¹æ§ã JNI·æè®¸ä½ å·²ç»æäºä¸ä¸ªç¨å ¶ä»è¯è¨åæçåºæç¨åºï¼èä½ å¸æå¨javaç¨åºä¸ä½¿ç¨å®ãä½ å¯è½éè¦ç¨åºå±è¯è¨å®ç°ä¸ä¸ªå°åçæ¶é´ææ代ç ï¼æ¯å¦æ±ç¼ï¼ç¶åå¨ä½ çjavaç¨åºä¸è°ç¨è¿äºåè½ã NDKæ¯Googleå ¬å¸æ¨åºç帮å©Androidå¼åè éè¿C/C++æ¬å°è¯è¨ç¼ååºç¨çå¼åå ï¼å å«äºC/C++ç头æ件ãåºæ件ã说æææ¡£å示ä¾ä»£ç ï¼æ们å¯ä»¥ç解为Windows Platform SDKä¸æ ·ï¼æ¯çº¯C/C++ç¼åçï¼ä½æ¯Android并ä¸æ¯æ纯C/C++ç¼åçåºç¨ï¼åæ¶NDKæä¾çåºåå½æ°åè½å¾æéï¼ä» ä» å¤çäºç®æ³æçææçé®é¢ï¼æ以æ¨èåå¦è å¦å¥½Javaååå¦ä¹ JNIã NDKéæäºäº¤åç¼è¯å¨ï¼å¹¶æä¾äºç¸åºçmkæ件é离CPUãå¹³å°ãABIçå·®å¼ï¼å¼å人ååªéè¦ç®åä¿®æ¹mkæ件(æåºâåªäºæ件éè¦ç¼è¯âãâç¼è¯ç¹æ§è¦æ±âç)ï¼å°±å¯ä»¥å建åºsoã NDKå¯ä»¥èªå¨å°å°soåJavaåºç¨ä¸èµ·æå ï¼æ大å°åè½»äºå¼å人åçæå å·¥ä½ã
Android JNI/NDK环境的配置与Demo编译
在Android开发中,JNI(Java Native Interface)与NDK(Native Development Kit)起着关键作用,源码它们旨在提升性能、源码代码复用和访问底层资源。源码
NDK,源码吃鸡推广源码作为开发工具包,源码电脑windows源码大全允许开发者用C和C++编写应用组件,源码提供了必要的源码工具和库来编译本地代码并生成.so文件。它适用于优化性能、源码利用现有C/C++库和直接操作系统底层API。源码
JNI则连接Java和本地代码,源码使得Java能调用C/C++实现的源码函数,反之亦然。源码电子宠物程序源码对于计算密集型任务或对实时性要求高的源码场景,JNI能显著提高性能。源码例如,游戏开发中,dkx买卖指标源码JNI和NDK能提供流畅的游戏体验,通过C/C++直接操作图像和硬件。
要使用这些工具,首先,cms系统源码免费你需要配置NDK环境。接着,从Java类生成JNI头文件,编写并实现C/C++代码,用CMake或ndk-build进行编译。在Android项目中,确保build.gradle配置了NDK,通过Gradle编译项目,并在Java代码中加载.so库,调用本地方法。
总的来说,通过正确的配置和实践,JNI和NDK为Android开发者提供了强大的性能优化和扩展能力。要体验它们的效益,开发者需要遵循特定的步骤和配置,以确保代码的顺利编译和运行。
å®åjniå¼åï¼
å¦ä½ç¼åå®å软件
1ãè§ææ2é1å®åçæ¬ï¼åå¼å§ä¹ä¸ç¥ééé¢æäºä»ä¹ææ¯é¾åº¦ï¼ä½æ¯è¦åçç®æ å·²ç»æç¡®äºï¼èä¸ä¹æ²¡æç°æçï¼ç¢°å°é®é¢å°±æ¥èµæï¼æ ¢æ ¢å°è§£å³ï¼è¿æ ·æçæ¾ç¢ï¼å¦ä¹ çææé常好ã
2ãä¸é¢æå°±å¼å§ä»ç»æ们å¼åéè¦ç¨ç软件ï¼Xcode(软件ä¸è½½å°åï¼developer.apple/xcode/)ï¼IOS模æå¨ã
3ãéæ±åæãç¡®å®è¦å¼åæä¸æ¬¾è½¯ä»¶çåæ¶è¦å¯¹éæ±è¿è¡åæï¼å¼åçappæå®é å®ç¨æä¹æå¯ä»¥ãå¼åè éè¦å¯¹è½¯ä»¶ç³»ç»è¿è¡æ¦è¦è®¾è®¡ï¼å³ç³»ç»è®¾è®¡ã
4ãè°·ææ¨åºçAppInventorAndroidAppå¼åå·¥å ·å¯ä»¥è®©ä½ ä» éè¿ææå¼çç®åæä½å°±å¯ä»¥å建èªå·±çAndroidAppã对äºé£äºä¸ºäºç¹å®ç®çæ³è¦å¨æå°è¯å¼åä¸ä¸ªç®ååºç¨çç¨æ·ã
5ãEclipseADTEclipseADTæ¯Eclipseå¹³å°ä¸ç¨æ¥å¼åAndroidåºç¨ç¨åºçæ件TheSDKandAVDManagerè¯¥å·¥å ·å å«å¾å¤éè¦çåè½ï¼å æ¬ç®¡çä¸åçAndroidSDKçæ¬ï¼æ建ç®æ ï¼ï¼Androidççæ¬ä¼å¤ï¼APIä¸æäºå ¼å®¹æ§é®é¢ã
6ãä¸é¢ï¼ä¸ç§è±æ就为大家æ®åä¸ä¸å®å软件å¼åå ¥é¨ç¥è¯ãå级é¶æ®µè¦å¦ä¹ çå 容é ç½®ç¯å¢ï¼å ¨é¨éç¨åæ°çæ¬SDKãADTãECLIPSEãJDKãç¼åæè è¿è¡æå¦ç¤ºä¾è¿æ¶é´ä¸»è¦è¿è¡ç示ä¾å¦HELLOWORLDï¼è¿æSDK带çä¾åã
Androidä¸æä¹éè¿JNIç¼ç¨å»åéadbæ令æ§å¶ææºç¼åä¸ä¸ªCç¨åºï¼ä½¿ç¨system(âcmdline)ï¼ç´æ¥è°ç¨å½ä»¤è¡ç¨åºå³å¯ã
(constchar*)(*env)-GetStringUTFChars(envï¼inputStrï¼JNI_FALSE)ï¼LOGI(dufresne---%sï¼(constchar*)str)ï¼//éç¥èææºæ¬å°ä»£ç ä¸åéè¦éè¿str访é®Javaå符串ã
$cd~/project/Android/JNITest/bin$cd~/project/Android/JNITest/binæ们ç¨lså½ä»¤æ¥çï¼å¯ä»¥çå°binç®å½ä¸æ个classesç®å½ï¼å ¶ç®å½ç»æ为classes/org/tonny/jniï¼å³classesçåç®å½ç»ææ¯androidå·¥ç¨çå åorg.tonny.jniã
å¦ä½ç¨javaè¿è¡å®ååºç¨çå¼åç´æ¥ç¾åº¦æç´¢å®åå¼åæç¨ï¼èµæºé常å¤ãå å»æJavaåCå¦å¥½å说ã
æ¯çï¼Javaå¯ä»¥ç¨äºå¼åå®ååºç¨ãå®ååºç¨çå¼åå¯ä»¥ä½¿ç¨Javaç¼ç¨è¯è¨åAndroidSDKï¼è½¯ä»¶å¼åå·¥å ·å ï¼ãè³äºâå®åæ¯å¦ä¼ä¸è½½å± æ°âï¼æä¸å¤ªæç½æ¨çææã
第ä¸æ¥ï¼å®è£ jdkï¼é ç½®jdkç¯å¢ãç¾åº¦æjdké 置第äºæ¥ï¼å®è£ AndroidStudio+SDKãæè Eclipse+ADT+AndroidSDKã第ä¸æ¥ï¼éè¦Androidæºåæè å®è£ èææºãå¦æçé®ï¼è¯·æåºã
ä¸ï¼JavaSEç¼ç¨Javaæ¯ä¸ç§é¢å对象çå¼åè¯è¨ï¼Androidæä½ç³»ç»çåºç¨å±ä½¿ç¨Javaè¯è¨æ¥å¼åï¼æ以è¦æ³è¿è¡Androidå¼åå¿ é¡»æè¯å¥½çJavaåºç¡ã
Androidåºç¨ç¨åºå¼åæ¯ä»¥Javaè¯è¨ä¸ºåºç¡çï¼æ以éè¦ææå®çJavaåºç¡ç¥è¯ãé¦å çæjavaåºæ¬è¯æ³ï¼ç¶åçæ设计模å¼çã
ç¨jniåçå®ååºç¨è½è¢«åç¼è¯å
å°ç¨åºè½¬æ¢ææ¬å°ä»£ç ä¹æ¯ä¸ç§é²æ¢åç¼è¯çæææ¹æ³ãå 为æ¬å°ä»£ç å¾å¾é¾ä»¥è¢«åç¼è¯ãå¼å人åå¯ä»¥éæ©å°æ´ä¸ªåºç¨ç¨åºè½¬æ¢ææ¬å°ä»£ç ï¼ä¹å¯ä»¥éæ©å ³é®æ¨¡å转æ¢ã
æå ç§æ¹å¼æ¥æé«è¢«åç¼è¯å代ç çé¾åº¦ï¼1å ³é®ä»£ç 使ç¨jniè°ç¨æ¬å°ä»£ç ï¼ç¨cæè c++ç¼åï¼å æ¤ç¸å¯¹æ¯è¾é¾äºåç¼è¯2æ··æ·java代ç ãæ··æ·æ¯ä¸æ¹å代ç é»è¾çæ åµä¸ï¼å¢å æ ç¨ä»£ç ï¼æè éå½åï¼ä½¿åç¼è¯åçæºä»£ç é¾äºçæã
ç±äºapkæ¯Androidèææºå è½½çï¼å®æä¸å®çè§èï¼å å¯apkåDalvikæ æ³è¯å«apkäºãå®å ¨é¿å æ¯ä¸å¯è½çï¼æ»æ人è½å¤ç ´è§£åç代ç ãä½æ¯æå ç§æ¹å¼æ¥æé«è¢«åç¼è¯å代ç çé¾åº¦ã
å¦ä½JAVA代ç è°ç¨ï¼jniå§ï¼å®åçSOæ件æ¯linuxä¸çæ件ï¼ç¨cæè c++åçã
ä¸é¢è¯´äºï¼è¿ç§æ¹å¼å ¶å®å¹¶ä¸æ¯çæ£å å¯ä»£ç ï¼å ¶å®ä»£ç è¿æ¯è½å¤è¢«äººåç¼è¯(æ人å¯è½è¯´ï¼ä½¿ç¨proguardä¸çoptimizeé项ï¼å¯ä»¥ä»åèæµå±é¢æ´æ¹ä»£ç ï¼çè³å¯ä»¥è®©JDè¿äºåç¼è¯è½¯ä»¶å¯ä»¥æ æ³å¾å°å 容ã
Androidä¸JNIæ¯ç¼è¯soåºçæºä»£ç ï¼ç¼è¯æååä¼çæSOåºï¼androidä¸æç»æ¯ä½¿ç¨SOåºçã
å®åå¼åè°ç¨åºå±ç¡¬ä»¶æä½æ¹æ³å¦ä¸ï¼ç¼è¯åå®è£ 该çæçapkå³å¯ä½¿ç¨è¯¥ç¨åºè°ç¨åºå±ç¡¬ä»¶é©±å¨ã大æ¦æ´ä¸ªè¿ç¨å°±è¿æ ·ï¼ä¸å±appè°ç¨æ¡æ¶å±çjavaæ¥å£ï¼javaæ¥å£éè¿jniè°ç¨ç¡¬ä»¶æ½è±¡å±å³å¯ã
ï¼Androidåºç¨ç¨åºå±ï¼2ï¼åºç¨ç¨åºæ¡æ¶å±ï¼3ï¼ç³»ç»è¿è¡åºå±ï¼4ï¼Linuxæ ¸å¿å±ã
å¯ä»¥åèä¸ä¸/sdk/ndk/index.htmlä¸è½½ndkï¼ç®åææ°çæ¬ä¸ºandroid-ndk-r6b-linux-x.tar.bz2.
ããï¼2ï¼è§£åndkå°å·¥ä½ç®å½ï¼
ãã[plain] view plaincopyprint?
ãã.$tar -xvf android-ndk-r6b-linux-x.tar.bz2
ãã.$sudo mv android-ndk-r6b /usr/local/ndk
ãã$tar -xvf android-ndk-r6b-linux-x.tar.bz2
ãã$sudo mv android-ndk-r6b /usr/local/ndk
ããï¼3ï¼è®¾ç½®ndkç¯å¢åé
ãã[plain] view plaincopyprint?
ãã.$sudo vim /etc/profile
ãã.exportPATH=/usr/local/ndk:$PATH
ãã$sudo vim /etc/profile
ããexportPATH=/usr/local/ndk:$PATH
ããç¼è¾å®æ¯åä¿åéåºï¼å¹¶éå¯çæ
ããï¼4ï¼éªè¯å®è£
ãã[plain] view plaincopyprint?
ãã.$ cd/usr/local/ndk/samples/hello-jni/
ãã.$ ndk-build
ãã.Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
ãã.Gdbsetup : libs/armeabi/gdb.setup
ãã.Install : libhello-jni.so => libs/armeabi/libhello-jni.so
ãã$ cd/usr/local/ndk/samples/hello-jni/
ãã$ ndk-build
ããGdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
ããGdbsetup : libs/armeabi/gdb.setup
ããInstall : libhello-jni.so => libs/armeabi/libhello-jni.so
ãã3.JNIå®ç°
ããæ们éè¦å®ä¹ä¸ä¸ªç¬¦åJNIæ¥å£è§èçc/c++æ¥å£ï¼è¿ä¸ªæ¥å£ä¸ç¨å¤ªå¤æï¼ä¾å¦è¾åºä¸ä¸ªå符串ãæ¥ä¸æ¥ï¼åéè¦æc/c++æ¥å£ç代ç æ件ç¼è¯æå ±äº«åºï¼å¨æåºï¼.soæ件ï¼å¹¶æ¾å°æ¨¡æå¨çç¸å ³ç®å½ä¸ãæåï¼å¯å¨Javaåºç¨ç¨åºï¼å°±å¯ä»¥çå°æç»ææäºã
ãã3.1.ç¼åJavaåºç¨ç¨åºä»£ç
ããï¼1ï¼å¯å¨Eclipseï¼æ°å»ºandroidå·¥ç¨
ããProjectï¼JNITest
ããPackageï¼org.tonny.jni
ããActivityï¼JNITest
ããï¼2ï¼ç¼è¾èµæºæ件
ããç¼è¾res/values/strings.xmlæ件å¦ä¸ï¼
ãã
ããç¼è¾res/layout/main.xmlæ件
ããæ们å¨ä¸»çé¢ä¸æ·»å äºä¸ä¸ªEditTextæ§ä»¶åä¸ä¸ªButtonæ§ä»¶ã
ããï¼3ï¼ç¼è¾JNITest.javaæ件
ã
ããstatic表示å¨ç³»ç»ç¬¬ä¸æ¬¡å 载类çæ¶åï¼å æ§è¡è¿ä¸æ®µä»£ç ï¼å¨è¿é表示å è½½å¨æåºlibJNITest.soæ件ã
ããåçè¿ä¸æ®µï¼
ãã[java] view plaincopyprint?
ãã.privatenativeString GetReply();
ããprivatenativeString GetReply();
ããnative表示è¿ä¸ªæ¹æ³ç±æ¬å°ä»£ç å®ä¹ï¼éè¦éè¿jniæ¥å£è°ç¨æ¬å°c/c++代ç ã
ãã[java] view plaincopyprint?
ãã.publicvoidonClick(View arg0) {
ãã.edtName.setText(reply);
ãã.}
ããpublicvoidonClick(View arg0) {
ããedtName.setText(reply);
ãã}
ããè¿æ®µä»£ç 表示ç¹å»æé®åï¼ænativeæ¹æ³çè¿åçå符串æ¾ç¤ºå°EditTextæ§ä»¶ã
ããï¼4ï¼ç¼è¯å·¥ç¨ï¼çæ.classæ件ã
ãã3.2.ç¨javahå·¥å ·çæ符åJNIè§èçcè¯è¨å¤´æ件
ããå¨ç»ç«¯ä¸ï¼è¿å ¥androidå·¥ç¨æå¨çbinç®å½
ãã[plain] view plaincopyprint?
ãã.$cd ~/project/Android/JNITest/bin
ãã$cd ~/project/Android/JNITest/bin
ããæ们ç¨lså½ä»¤æ¥çï¼å¯ä»¥çå°binç®å½ä¸æ个classesç®å½ï¼å ¶ç®å½ç»æ为classes/org/tonny/jniï¼å³classesçåç®å½ç»ææ¯androidå·¥ç¨çå åorg.tonny.jniã请注æï¼ä¸é¢æ们åå¤æ§è¡javahå½ä»¤çæ¶åï¼å¿ é¡»è¿å ¥å°org/tonny/jniçä¸çº§ç®å½ï¼å³classesç®å½ï¼å¦åjavahä¼æ示æ¾ä¸å°ç¸å ³çjavaç±»ã
ããä¸é¢ç»§ç»ï¼
ãã[plain] view plaincopyprint?
ãã.$cd classes
ãã.$javah org.tonny.jni.JNITest
ãã.$ls
ãã.org org_tonny_jni_JNITest.h
ãã$cd classes
ãã$javah org.tonny.jni.JNITest
ãã$ls
ããorg org_tonny_jni_JNITest.h
ããæ§è¡javahorg.tonny.jni.JNITestå½ä»¤ï¼å¨classesç®å½ä¸ä¼çæorg_tonny_jni_JNITest.h头æ件ãå¦æä¸è¿å ¥å°classesç®å½ä¸çè¯ï¼ä¹å¯ä»¥è¿æ ·ï¼
ãã[plain] view plaincopyprint?
ãã.$javah -classpath ~/project/Android/JNITest/bin/classesorg.tonny.jni.JNITest
ãã$javah -classpath ~/project/Android/JNITest/bin/classesorg.tonny.jni.JNITest
ãã-classpath åæ°è¡¨ç¤ºè£ 载类çç®å½ã
ãã3.3.ç¼åc/c++代ç
ããçæorg_tonny_jni_JNITest.h头æ件åï¼æ们就å¯ä»¥ç¼åç¸åºçå½æ°ä»£ç äºãä¸é¢å¨androidå·¥ç¨ç®å½ä¸æ°å»ºjniç®å½ï¼å³~/project/Android/JNITest/jniï¼æorg_tonny_jni_JNITest.h头æ件æ·è´å°jniç®å½ä¸ï¼å¹¶å¨jniç®å½ä¸æ°å»ºorg_tonny_jni_JNITest.cæ件ï¼ç¼è¾ä»£ç å¦ä¸ï¼
ãã[cpp] view plaincopyprint?
ãã.#include<jni.h>
ãã.#include<string.h>
ãã.#include"org_tonny_jni_JNITest.h"
ãã.
ãã.
ãã.JNIEXPORTjstring JNICALLJava_org_tonny_jni_JNITest_GetReply
ãã.(JNIEnv *env, jobject obj){
ãã.return(*env)->NewStringUTF(env,(char*)"Hello,JNITest");
ãã.}
ãã#include<jni.h>
ãã#include<string.h>
ãã#include"org_tonny_jni_JNITest.h"
ããJNIEXPORTjstring JNICALLJava_org_tonny_jni_JNITest_GetReply
ãã(JNIEnv *env, jobject obj){
ããreturn(*env)->NewStringUTF(env,(char*)"Hello,JNITest");
ãã}
ããæ们å¯ä»¥çå°ï¼è¯¥å½æ°çå®ç°ç¸å½ç®åï¼è¿åä¸ä¸ªå符串为ï¼"Hello,JNITest"
ãã3.4.ç¼åAndroid.mkæ件
ããå¨~/project/Android/JNITest/jniç®å½ä¸æ°å»ºAndroid.mkæ件ï¼androidå¯ä»¥æ ¹æ®è¿ä¸ªæ件çç¼è¯åæ°ç¼è¯æ¨¡åãç¼è¾Android.mkæ件å¦ä¸ï¼
ãã[plain] view plaincopyprint?
ãã.LOCAL_PATH:= $(call my-dir)
ãã.include$(CLEAR_VARS)
ãã.LOCAL_MODULE := libJNITest
ãã.LOCAL_SRC_FILES:= org_tonny_jni_JNITest.c
ãã.include$(BUILD_SHARED_LIBRARY)
ããLOCAL_PATH:= $(call my-dir)
ããinclude$(CLEAR_VARS)
ããLOCAL_MODULE := libJNITest
ããLOCAL_SRC_FILES:= org_tonny_jni_JNITest.c
ããinclude$(BUILD_SHARED_LIBRARY)
ããLOCAL_MODULE表示ç¼è¯çå¨æåºå称
ããLOCAL_SRC_FILES 表示æºä»£ç æ件
ãã3.5.ç¨ndkå·¥å ·ç¼è¯å¹¶çæ.soæ件
ããè¿å ¥å°JNITestçå·¥ç¨ç®å½ï¼æ§è¡ndk-buildå½ä»¤å³å¯çælibJNITest.soæ件ã
ãã[plain] view plaincopyprint?
ãã.$cd ~/project/Android/JNITest/
ãã.$ndk-build
ãã.Invalidattribute name:
ãã.package
ãã.Install : libJNITest.so => libs/armeabi/libJNITest.so
ãã$cd ~/project/Android/JNITest/
ãã$ndk-build
ããInvalidattribute name:
ããpackage
ããInstall : libJNITest.so => libs/armeabi/libJNITest.so
ããå¯ä»¥çå°ï¼å¨å·¥ç¨ç®å½çlibs/armeabiç®å½ä¸çæäºlibJNITest.soæ件ã
ãã3.6.å¨æ¨¡æå¨ä¸è¿è¡
ããï¼1ï¼é¦å ï¼æ们æandroid模æå¨å¯å¨èµ·æ¥ãè¿å ¥å°emulatoræå¨ç®å½ï¼æ§è¡emulatorå½ä»¤ï¼
ãã[plain] view plaincopyprint?
ãã.$cd ~/software/android/android-sdk-linux/tools
ãã.$./emulator @AVD-2.3.3-V -partition-size
ãã$cd ~/software/android/android-sdk-linux/tools
ãã$./emulator @AVD-2.3.3-V -partition-size
ããAVD-2.3.3-Vè¡¨ç¤ºä½ ç模æå¨å称ï¼ä¸å¨Eclipse->AVDManagerä¸çAVDName对åºï¼-partition-size表示模æå¨çåå¨è®¾å¤å®¹éã
ããï¼2ï¼æ¥ä¸æ¥ï¼æ们éè¦ælibJNITest.soæ件æ·è´å°æ¨¡æå¨ç/system/libç®å½ä¸ï¼æ§è¡ä»¥ä¸å½ä»¤ï¼
ãã[plain] view plaincopyprint?
ãã.$cd ~/project/Android/JNITest/libs/armeabi/
ãã.$adb remount
ãã.$adb push libJNITest.so /system/lib
ãã. KB/s ( bytes in 0.s)
ãã$cd ~/project/Android/JNITest/libs/armeabi/
ãã$adb remount
ãã$adb push libJNITest.so /system/lib
ãã KB/s ( bytes in 0.s)
ããå½å¨ç»ç«¯ä¸çå°æ KB/s ( bytes in 0.s)ä¼ è¾é度çä¿¡æ¯çæ¶åï¼è¯´ææ·è´æåã
ããï¼3ï¼å¨ç»ç«¯ä¸æ§è¡JNITestç¨åºï¼è¿ä¸ªæ们å¯ä»¥å¨Eclipseä¸ï¼å³é®ç¹å»JNITestå·¥ç¨ï¼RunAs->Android Applicationï¼å³å¯å¨æ¨¡æå¨ä¸å¯å¨ç¨åº