How do I run my packaged binary in my Android app?

前端 未结 2 1109
自闭症患者
自闭症患者 2021-02-10 16:34

I have an Android app that needs to run a custom binary app I wrote. I already built the binary using ndk and packaged it in the apk under res/raw

I did something like t

2条回答
  •  我在风中等你
    2021-02-10 17:15

    Adding to David Given's response, which is great, this is what I use at the end of Android.mk to rename the binary automatically. May be of some use to others trying the same thing:

    ...
    LOCAL_MODULE := yourbinarynamehere
    
    include $(BUILD_EXECUTABLE)
    
    all: $(LOCAL_MODULE)
        $(shell (mv libs/$(TARGET_ARCH_ABI)/$< libs/$(TARGET_ARCH_ABI)/lib$<.so))
    

    Mind the TAB before $(shell... spaces won't work as per standard GNU Make.

提交回复
热议问题