Want to compile native Android binary I can run in terminal on the phone

前端 未结 4 1513
粉色の甜心
粉色の甜心 2020-11-29 17:55

I\'ve been trying for a couple days to compile a native ARM Android binary that will execute on my phone using a terminal application. I want to generate the same type of bi

4条回答
  •  旧巷少年郎
    2020-11-29 18:19

    Just use the android-ndk. And build a Android.mk like so. include $(BUILD_EXECUTABLE) is what tells it build a executable instead of a JNI .lib

    Android.mk

    ifneq ($(TARGET_SIMULATOR),true)
    
    LOCAL_PATH:= $(call my-dir)
    
    include $(CLEAR_VARS)
    
    LOCAL_CFLAGS += -Wall
    
    
    LOCAL_LDLIBS := -L$(LOCAL_PATH)/lib -llog -g
    
    LOCAL_C_INCLUDES := bionic
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
    
    LOCAL_SRC_FILES:= main.cpp
    
    LOCAL_MODULE := mycmd
    
    include $(BUILD_EXECUTABLE)
    
    endif  # TARGET_SIMULATOR != true
    

提交回复
热议问题