2021.04.08
cmake
This commit is contained in:
15
app/src/main/cpp/native-lib.cpp
Normal file
15
app/src/main/cpp/native-lib.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Administrator on 2021/4/8.
|
||||
//
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring
|
||||
|
||||
JNICALL
|
||||
Java_com_tt_ttutils_jni_NDKTools_getStringFromNDK(
|
||||
JNIEnv *env, jobject /* this */) {
|
||||
std::string hello = "Hello from C++";
|
||||
return env->NewStringUTF(hello.c_str());
|
||||
}
|
||||
@@ -2,7 +2,8 @@ package com.tt.ttutils.jni;
|
||||
|
||||
public class NDKTools {
|
||||
static {
|
||||
System.loadLibrary("NDKTools-jni");
|
||||
// System.loadLibrary("NDKTools-jni");
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
|
||||
public static native String getStringFromNDK();
|
||||
|
||||
Reference in New Issue
Block a user