android ndk-build에 공유 라이브러리를 중간체/ndkbuild 폴더에 복사하지 못했습니다. 나는이 같은 Android.mk 내 모듈을 만들었습니다Android-ndk 잘못된 명령 생성
Android.mk
을LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
EXT_LIB_ROOT := $(LOCAL_PATH)/../prebuilt/dcmtk
LOCAL_MODULE := ofstd
LOCAL_SRC_FILES := $(EXT_LIB_ROOT)/ofstd/lib/$(TARGET_ARCH_ABI)/libofstd.so
LOCAL_EXPORT_C_INCLUDES := $(EXT_LIB_ROOT)/ofstd/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := oflog
LOCAL_SRC_FILES := $(EXT_LIB_ROOT)/oflog/lib/$(TARGET_ARCH_ABI)/liboflog.so
LOCAL_EXPORT_C_INCLUDES := $(EXT_LIB_ROOT)/oflog/include
LOCAL_SHARED_LIBRARIES := ofstd
include $(PREBUILT_SHARED_LIBRARY)
그것은 구축하고 생성 된 명령은 : 지금
D:\android-sdk\ndk-bundle\\build\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\dev\trunk\myApp\app\Android.mk NDK_APPLICATION_MK=C:\dev\trunk\myApp\app\Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=C:/dev/trunk/myApp/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n
이 로그의 출력이됩니다 :
md "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib\x86" >NUL 2>NUL || rem
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Gdbserver ": "[i686-linux-android] C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/gdbserver"
copy /b/y "D:\android-sdk\ndk-bundle\build\\..\prebuilt\android-x86\gdbserver\gdbserver" "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib\x86\gdbserver" > NUL
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Gdbsetup ": "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/gdb.setup"
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe "set solib-search-path C:/dev/trunk/myApp/app/build/intermediates/ndkBuild/debug/obj/local/x86" > C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/gdb.setup
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe "directory D:/android-sdk/ndk-bundle/build//../platforms/android-21/arch-x86 D:/android-sdk/ndk-bundle/build//../sources/cxx-stl/gnu-libstdc++ C:/dev/trunk/myApp/app/../prebuilt/dcmtk/ofstd/include" >> C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/gdb.setup
md "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\obj\local\x86" >NUL 2>NUL || rem
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Prebuilt ": "libofstd.so <= C:/dev/trunk/myApp/app/../prebuilt/dcmtk/ofstd/lib/x86/"
copy /b/y "C:\dev\trunk\myApp\app\..\prebuilt\dcmtk\ofstd\lib\x86\libofstd.so" "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\obj\local\x86\libofstd.so" > NUL
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Install ": "libofstd.so => C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/libofstd.so"
copy /b/y "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\obj\local\x86\libofstd.so" "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib\x86\libofstd.so" > NUL
D:/android-sdk/ndk-bundle/build//../toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-strip --strip-unneeded C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/libofstd.so
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Prebuilt ": "liboflog.so <= C:/dev/trunk/myApp/app/../prebuilt/dcmtk/oflog/lib/x86/"
copy /b/y "C:\dev\trunk\myApp\app\..\prebuilt\dcmtk\oflog\lib\x86\liboflog.so" "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\obj\local\x86\liboflog.so" > NUL
D:/android-sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [x86] "Install ": "liboflog.so => C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/liboflog.so"
copy /b/y "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\obj\local\x86\liboflog.so" "C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib\x86\liboflog.so" > NUL
D:/android-sdk/ndk-bundle/build//../toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-strip --strip-unneeded C:\dev\trunk\myApp\app\build\intermediates\ndkBuild\debug\lib/x86/liboflog.so
불행히도 파일이 복사되거나 생성되지 않습니다. 명령 줄에서 동일한 명령을 실행하면 결과가 동일합니다. 그러나 명령 끝에서 -n 플래그를 건너 뛰면 명령이 복사되는 파일과 함께 성공적으로 완료됩니다. 그래서, 내 질문에 어떻게 그 -n 생략하고 그 플래그의 목적은 무엇입니까? 최신 stable ndk 릴리스를 사용하고 있습니다.
makefile 스크립트를 컴파일하고 실행하기 때문에 분명히 ndkBuild 및 ndk-tools 경로를 선언했습니다. jniLibs.srcDir 'src/main/libs'를 설정하려고했지만 어떻게해야 할 지 모르겠습니다. –
@NumLock 터미널을 사용하여 빌드를 시도 했습니까? 그냥 jni 폴더로 가서 ndk-build를 실행하십시오. 공유 라이브러리를 만들면 다시 gradle 스크립트를 확인하십시오. – JavadKhan
나는 windows 명령 줄을 사용했고 앞에서 언급했듯이 ndk-build는 각 디렉터리에 파일을 복사하지만 -n 플래그를 건너 뛰는 경우에만 –