标签:
package com.coca.firstdemo;
/**
* Created by Administrator on 2016/6/6.
*/
public class JniShareUtils {
public native String getLogCount(String params);
}
javah com.coca.firstdemo.JniShareUtils
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_coca_firstdemo_JniShareUtils */
#ifndef _Included_com_coca_firstdemo_JniShareUtils
#define _Included_com_coca_firstdemo_JniShareUtils
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_coca_firstdemo_JniShareUtils
* Method: getLogCount
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_coca_firstdemo_JniShareUtils_getLogCount
(JNIEnv *, jobject, jstring);
#ifdef __cplusplus
}
#endif
#endif
#include "com_coca_firstdemo_JniShareUtils.h"
JNIEXPORT jstring JNICALL Java_com_coca_firstdemo_JniShareUtils_getLogCount
(JNIEnv *env, jobject obj, jstring jstr){
return (*env)->NewStringUTF(env,"This just a test for Android Studio NDK JNI developer!");
}
defaultConfig {
//...
ndk{
moduleName "wangjun_so_jni" //生成的so名字,名字随意
abiFilters "armeabi", "armeabi-v7a", "x86" //输出指定三种abi体系结构下的so库。目前可有可无。
}
}
static {
System.loadLibrary("wangjun_so_jni");//与上述build.gradle中定义的moduleName对应
}
package com.android.build.gradle.internal.dsl;
/**
* DSL object for NDK-related settings.
*/
public class NdkOptions implements CoreNdkOptions, Serializable {
private static final long serialVersionUID = 1L;
private String moduleName;
private String cFlags;
private List<String> ldLibs;
private Set<String> abiFilters;
private String stl;
private Integer jobs;
}
Android之JNI:Android Studio使用Gradle编译C/C++源码
标签:
原文地址:http://www.cnblogs.com/linux007/p/5782731.html