Android NDK : make: *** No rule to make target. Stop

时光怂恿深爱的人放手 提交于 2019-12-11 04:27:00

问题


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

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

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

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

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

Project structure looks like below:

When I am running ndk-build then I get

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 ?


回答1:


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


来源:https://stackoverflow.com/questions/44946675/android-ndk-make-no-rule-to-make-target-stop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!