我搜索了所有的网(我认为)。什么曾经说过我试过但没有运气 不工作 我在cygwin和windows下测试它 这是我的项目文件/目录:
D:\Java_2\workspace_indigo\JniTest\.classpath
D:\Java_2\workspace_indigo\JniTest\.project
D:\Java_2\workspace_indigo\JniTest\AndroidManifest.xml
D:\Java_2\workspace_indigo\JniTest\assets
D:\Java_2\workspace_indigo\JniTest\bin
D:\Java_2\workspace_indigo\JniTest\files
D:\Java_2\workspace_indigo\JniTest\gen
D:\Java_2\workspace_indigo\JniTest\native
D:\Java_2\workspace_indigo\JniTest\proguard.cfg
D:\Java_2\workspace_indigo\JniTest\project.properties
D:\Java_2\workspace_indigo\JniTest\res
D:\Java_2\workspace_indigo\JniTest\src
D:\Java_2\workspace_indigo\JniTest\bin\classes
D:\Java_2\workspace_indigo\JniTest\bin\res
D:\Java_2\workspace_indigo\JniTest\bin\classes\com
D:\Java_2\workspace_indigo\JniTest\bin\classes\jni
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\JniTestActivity.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\R$attr.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\R$drawable.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\R$layout.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\R$string.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\com\testjni\R.class
D:\Java_2\workspace_indigo\JniTest\bin\classes\jni\Natives.class
D:\Java_2\workspace_indigo\JniTest\gen\com
D:\Java_2\workspace_indigo\JniTest\gen\com\testjni
D:\Java_2\workspace_indigo\JniTest\gen\com\testjni\R.java
D:\Java_2\workspace_indigo\JniTest\native\Android.mk
D:\Java_2\workspace_indigo\JniTest\native\Application.mk
D:\Java_2\workspace_indigo\JniTest\native\include
D:\Java_2\workspace_indigo\JniTest\native\lib.c
D:\Java_2\workspace_indigo\JniTest\native\main.c
D:\Java_2\workspace_indigo\JniTest\native\Makefile
D:\Java_2\workspace_indigo\JniTest\native\testlib
D:\Java_2\workspace_indigo\JniTest\native\testlib.c
D:\Java_2\workspace_indigo\JniTest\native\include\jni_Natives.h
D:\Java_2\workspace_indigo\JniTest\native\include\jni_Natives.h_orig
D:\Java_2\workspace_indigo\JniTest\res\drawable-hdpi
D:\Java_2\workspace_indigo\JniTest\res\drawable-ldpi
D:\Java_2\workspace_indigo\JniTest\res\drawable-mdpi
D:\Java_2\workspace_indigo\JniTest\res\layout
D:\Java_2\workspace_indigo\JniTest\res\values
D:\Java_2\workspace_indigo\JniTest\res\drawable-hdpi\ic_launcher.png
D:\Java_2\workspace_indigo\JniTest\res\drawable-ldpi\ic_launcher.png
D:\Java_2\workspace_indigo\JniTest\res\drawable-mdpi\ic_launcher.png
D:\Java_2\workspace_indigo\JniTest\res\layout\main.xml
D:\Java_2\workspace_indigo\JniTest\res\values\strings.xml
D:\Java_2\workspace_indigo\JniTest\src\com
D:\Java_2\workspace_indigo\JniTest\src\jni
D:\Java_2\workspace_indigo\JniTest\src\com\testjni
D:\Java_2\workspace_indigo\JniTest\src\com\testjni\JniTestActivity.java
D:\Java_2\workspace_indigo\JniTest\src\jni\Natives.java
这是我的ndk NDK_LOG = 1输出:
D:\Java_2\workspace_indigo\JniTest>ndk-build NDK_LOG=1
Android NDK: NDK installation path auto-detected: 'D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: windows
Android NDK: Host operating system detected: windows
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to windows
Android NDK: Host tools prebuilt directory: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/prebuilt/windows/bin
Android NDK: Host 'echo' tool: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/prebuilt/windows/bin/echo.exe
Android NDK: Host 'awk' tool: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/prebuilt/windows/bin/awk.exe
Android NDK: Host 'awk' test returned: Pass
Android NDK: This NDK supports the following target architectures and ABIS:
Android NDK: arm: armeabi armeabi-v7a
Android NDK: mips: mips
Android NDK: x86: x86
Android NDK: This NDK supports the following toolchains and target ABIs:
Android NDK: arm-linux-androideabi-4.4.3: armeabi armeabi-v7a
Android NDK: mipsel-linux-android-4.4.3: mips
Android NDK: x86-4.4.3: x86
Android NDK: Found platform root directory: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms
Android NDK: Found supported platforms: android-14 android-3 android-4 android-5 android-8 android-9
Android NDK: PLATFORM android-14 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-14/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-14/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-14/arch-x86
Android NDK: PLATFORM android-3 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-3/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-3/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-3/arch-x86
Android NDK: PLATFORM android-4 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-4/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-4/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-4/arch-x86
Android NDK: PLATFORM android-5 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-5/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-5/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-5/arch-x86
Android NDK: PLATFORM android-8 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-8/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-8/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-8/arch-x86
Android NDK: PLATFORM android-9 supports: arm mips x86
Android NDK: ABI arm sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-9/arch-arm
Android NDK: ABI mips sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-9/arch-mips
Android NDK: ABI x86 sysroot is: D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/platforms/android-9/arch-x86
Android NDK: Found stable platform levels: 14 3 4 5 8 9
Android NDK: Found max platform level: 14
Android NDK: Found project path: .
Android NDK: Ouput path: ./obj
Android NDK: Parsing D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/build/core/default-application.mk
Android NDK: Found APP_PLATFORM=android-8 in ./project.properties
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: ./jni/Android.mk
D:/cpp/Android/android-ndk-r8-windows/android-ndk-r8/build/core/add-application.mk:133: *** Android NDK: Aborting... . Stop.
和我的Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Hello
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := lib.c
include $(BUILD_SHARED_LIBRARY)
and my Application.mk
APP_PROJECT_PATH := D:/Java_2/workspace_indigo/JniTest
像在文档中说的那样简单,但仍然不起作用..
为什么它不能正常运作的原因是什么?
答案 0 :(得分:7)
显然,您的Android.mk文件位于错误的位置,因为它的当前位置是:
native/Android.mk
并且您的构建脚本希望它在
中src/jni/Android.mk
您必须更改脚本或复制/移动文件。