android jni

1. 在Android工程需要用到jni的类中添加相应声明:

public class GameData {
    final static String TAG = "GameData"; 
    final static String INDEX_FILE = "index.li";
    final static String DTAT_DIRECTORY = "data/";
    
    static{
        try{
            System.loadLibrary("aes");
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
    private static native String[] DecodeFile(String file); 
    ...
}

 

2. #cd Android_Project/bin

#javah -classpath ./classes -jni com.bochengyishi.guessstock.GameData

在当前目录下生成了jni头文件com_bochengyishi_guessstock_GameData.h

#ls

AndroidManifest.xml jarlist.cache resources.ap_ classes com_bochengyishi_guessstock_GameData.h proguard.txt SplashActivity.apk
classes.dex dexedLibs res

 

 3. #cd Android_Project

#mkdir jni;mv ../bin/com_bochengyishi_guessstock_GameData.h .

 

posted @ 2015-07-27 10:39    阅读(277)  评论(0编辑  收藏  举报