简体   繁体   中英

Android NDK - build executable with .so extension

How can I build an executable with Android NDK ( include $(BUILD_EXECUTABLE) ) but with file extension.

Here is my Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := ls
LOCAL_SRC_FILES := ls.c

include $(BUILD_EXECUTABLE)

It works as expected, but file is without extension. If library doesn't have .so extension it doesn't get packed into the apk .

I did his:

#!/usr/bin/env bash

ndk-build
cd ../libs
for f in $(ls .);
do
    mv $f/ls $f/libls.so
done

This script should be put in jni folder, and instead of calling just ndk-build i call this script.
Its not dynamic, name of the executable is hardcoded, but is does the job in my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM