Android NDK : make: *** No rule to make target. 停止

标签 android c++ android-ndk libusb libusb-1.0

我正在尝试构建 libusb使用 NDK。这是我的 Android.mkApplication.mk我检查了这个线程 Android NDK: No rule to make target但它对我不起作用。

安卓.mk

include $(CLEAR_VARS)
LOCAL_MODULE    := libusb
LOCAL_SRC_FILES := libusb/core.c libusb/descriptor.c libusb/io.c libusb/sync.c libusb/os/linux_usbfs.c

LOCAL_LDLIBS    := -llog
include $(BUILD_SHARED_LIBRARY)

应用程序.mk

APP_ABI:= all
APP_LDFLAGS:= -llog
APP_STL:= stlport_shared
APP_CPP_FEATURES:= exceptions
APP_PLATFORM:= android-21
APP_CFLAGS:= -g

构建.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.williams.libusbpoc"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

本地.properties

ndk.dir=C\:\\android-ndk-r15

项目结构如下:

enter image description here

当我运行时 ndk-build然后我得到

ndk-build
Android NDK: WARNING: APP_PLATFORM android-21 is higher than android:minSdkVersion 1 in D:/williams/android/libusbpoc/app/src/main/AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-21. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
make: *** No rule to make target `C:/android-ndk-r15/build//../sources/cxx-stl/stlport/libusb/core.c', needed by `D:/williams/android/libusbpoc/app/src/main/obj/local/arm64-v8a/objs/usb/libusb/core.o'.  Stop.

有谁知道我做错了什么?

最佳答案

看起来您忘记设置 LOCAL_PATH,即在您的 Android.mk 中您应该:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#  ..etc as before..

关于Android NDK : make: *** No rule to make target. 停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44946675/

相关文章:

java - 为邮政编码分配值

java - 使用端点从谷歌数据存储中删除/删除,非法争论异常,不支持使用非零内容长度删除

c++ - C++函数的参数

c++ - 无法连接 C++ 和 Qml(连接)

android - 对 'rindex' 的 undefined reference

android - 如何使用 OpenCV 从 C++ 程序制作 Android 应用程序

java - Android NDK jni问题

android - 禁用 DrawerLayout 的稀松布触摸手势

android - 我无法在 SQLite 中保存没有重复的记录

C++/STL 我应该使用哪种算法来检查容器是否有重复项?