NDK can't find the application directory

后端 未结 11 1913
余生分开走
余生分开走 2020-12-12 15:03

When running the ndk-build command I get the following error:

Android NDK: Could not find application project directory !    
Android NDK: Please define the          


        
11条回答
  •  悲哀的现实
    2020-12-12 15:34

    I haven't found a single answer which is satisfactory for me, perhaps it depends whether you're trying to build an existing application, create a new one, or perhaps you are porting some existing native app. These guidelines work with android-ndk-r9b but should work with the last few releases

    The makefile build-local.mk used by ndk-build will make some guesses about the location of the application makefile.

    By default it seems the NDK is oriented towards having you stow your NDK application Application.mk and Android.mk files under a sub-directory called jni. This works nicely, and you can just use the command line:

    $ ndk-build
    

    If you don't want to have a jni sub-directory, for example, perhaps you're porting a linux command-line tool to Android, the following maybe appropriate for you:

    Create an empty AndroidManifest.xml file

    Now create an Application.mk file with the following contents:

    APP_BUILD_SCRIPT := Android.mk
    

    Then create an Android.mk file, for example:

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := foo.c
    LOCAL_MODULE := foo
    include $(BUILD_EXECUTABLE)
    

    To build the application use:

    $ ndk-build NDK_APPLICATION_MK=`pwd`/Application.mk
    

提交回复
热议问题