Skip to content

Instantly share code, notes, and snippets.

@Nimrodda
Created March 5, 2015 14:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nimrodda/c9bdb9217dffe577af79 to your computer and use it in GitHub Desktop.
Save Nimrodda/c9bdb9217dffe577af79 to your computer and use it in GitHub Desktop.
Sample Android.mk with prebuilt static library
LOCAL_PATH := $(call my-dir)
# hatch library
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-static-lib
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libprebuilt-static-lib.a
# The header files should be located in the following dir relative to jni/ dir
LOCAL_EXPORT_C_INCLUDES := include/
include $(PREBUILT_STATIC_LIBRARY)
# main
include $(CLEAR_VARS)
LOCAL_MODULE := my-jni
# List of source files *.cpp files
LOCAL_SRC_FILES := my.cpp bla.cpp baba.cpp
# Using android logging library
LOCAL_LDLIBS := -llog
# Define pre-processor macro for log levels
LOCAL_CFLAGS := -DLOG_LEVEL=LOG_VERBOSE
# Link with the prebuilt module that we defined and the top part of this file
LOCAL_STATIC_LIBRARIES := prebuilt-static-lib
include $(BUILD_SHARED_LIBRARY)
@vince-styling
Copy link

great snippet

@kangisme
Copy link

The definition of $(PREBUILT_STATIC_LIBRARY) has been removed, do not use

@llothar
Copy link

llothar commented Oct 31, 2023

I'm an Android beginner. How does the whole gradle module for a prebuild lib has to looks like ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment