Skip to content

Latest commit

 

History

History

example-android

KittyMemory Android Example

This is an example android shared lib.

Requires C++11 or above.
Android API 21 or above for keystone linking.

See how to use KittyMemory in example.cpp.

Clone:

git clone --recursive https://github.com/MJx0/KittyMemory.git

How to build:

NDK Build:

  • In your Android.mk somewhere at top, define:
KITTYMEMORY_PATH = path/to/KittyMemory
KITTYMEMORY_SRC = $(wildcard $(KITTYMEMORY_PATH)/*.cpp)
  • Inlcude Keystone static lib:
include $(CLEAR_VARS)
LOCAL_MODULE    := Keystone
LOCAL_SRC_FILES := $(KITTYMEMORY_PATH)/Deps/Keystone/libs-android/$(TARGET_ARCH_ABI)/libkeystone.a
include $(PREBUILT_STATIC_LIBRARY)
  • Add KittyMemory source files:
LOCAL_SRC_FILES := example.cpp $(KITTYMEMORY_SRC)
  • Finally add keystone static lib:
LOCAL_STATIC_LIBRARIES := Keystone

You can check example here Android.mk.

CMake Build:

  • In your CMakeLists.txt somewhere at top, define:
set(KITTYMEMORY_PATH path/to/KittyMemory)
file(GLOB KITTYMEMORY_SRC ${KITTYMEMORY_PATH}/*.cpp)
  • Inlcude Keystone static lib:
set(KEYSTONE_LIB ${KITTYMEMORY_PATH}/Deps/Keystone/libs-android/${CMAKE_ANDROID_ARCH_ABI}/libkeystone.a)
  • Add KittyMemory source files:
add_library(YourProjectName SHARED example.cpp ${KITTYMEMORY_SRC})
  • Finally add keystone static lib:
target_link_libraries(YourProjectName ${KEYSTONE_LIB})
## or
link_libraries(${KEYSTONE_LIB})

You can check example here CMakeLists.txt.