Android NDK:make:***没有规则可以成为目标.停止 [英] Android NDK : make: *** No rule to make target. Stop

查看:212
本文介绍了Android NDK:make:***没有规则可以成为目标.停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用NDK构建 libusb .这是我的Android.mkApplication.mk我已经检查了此线程 Android NDK:没有制定目标的规则,但对我却没有用.

I am trying to build libusb using the NDK. Here is my Android.mk and Application.mk I have checked this thread Android NDK: No rule to make target but it didn't work for me.

Android.mk

Android.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)

Application.mk

Application.mk

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

build.gradle

build.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'
}

local.properties

local.properties

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

项目结构如下:

当我运行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.

有人知道我在做什么错吗?

Does anyone know what I am doing wrong ?

推荐答案

好像您忘了设置LOCAL_PATH一样,也就是说,在您的Android.mk中您应该具有:

Looks like you forgot to set LOCAL_PATH, i.e. in your Android.mk you should have:

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

这篇关于Android NDK:make:***没有规则可以成为目标.停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆