Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7920371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:11:42+00:00 2026-06-03T16:11:42+00:00

I have an Android JNI project I’d like to compile with ndk-build . The

  • 0

I have an Android JNI project I’d like to compile with ndk-build. The project contains of multiple third-party sub projects.

+- jni
   +- Android.mk
   +- my-proj.mk
   +- other-proj.mk
   +- my-proj
      +- a.cpp
      +- b.cpp
   +- other-proj  (third-party)
      +- c.cpp
      +- d.cpp

The idea now is to include/import the makefiles of all sub projects in Android.mk, like this:

LOCAL_PATH := $(call my-dir)

include $(LOCAL_PATH)/my-proj.mk
include $(LOCAL_PATH)/other-proj.mk

other-proj is built as static library. my-proj.mk depends on other-proj and is built as shared library.

Building this project works. However, modifying either my-proj.mk or other-proj.mk doesn’t trigger a rebuild of the respective project. Is there a way to do this?

I though I could list the makefiles as dependencies of Android.mk but I couldn’t figure out a way. (Listing them under LOCAL_SRC_FILES doesn’t work.)

I also read about $(call import-module,foo/bar) which seems to do exactly what I want. However, in this case I had to place the makefiles in a directory adjacent to the project directories (e.g. jni/makefiles/other-proj/Android.mk) but I couldn’t figure out how to specify the LOCAL_SRC_FILES. They don’t seem to like to be specified with an absolute path or with a .. inside the path. (I can’t place the makefiles directly in the sub project directories as they’re third-party projects.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:11:43+00:00Added an answer on June 3, 2026 at 4:11 pm

    I figured out a way to do it, although not with simple includes but rather with $(call import-module,foo/bar).

    First change, you need to decide on one of the sub projects being the main project. Let’s take my-proj for that. Then the directory structure changes like this:

    +- jni
       +- Android.mk
       +- my-proj
          +- a.cpp
          +- b.cpp
       +- other-proj  (third-party)
          +- Android.mk
          +- c.cpp
          +- d.cpp
    

    Basically I renamed my-proj.mk to /Android.mk and other-proj.mk to other-proj/Android.mk.

    The main Android.mk then changes to something like this:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    ...
    LOCAL_STATIC_LIBRARIES := other-proj
    include $(BUILD_SHARED_LIBRARY)
    
    $(call import-add-path,$(LOCAL_PATH))
    $(call import-module,other-proj)
    

    The other-proj is included in the last line.

    Note that the line before the last line sets the module path. Setting the module path from within the makefile via

    NDK_MODULE_PATH := $(LOCAL_PATH)
    

    does not work. (If NDK_MODULE_PATH is to be used, it needs to be defined as an environment variable outside of the makefile).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android project that contains a class that uses JNI to pull
I have an Android NDK project. Windows 7, Cygwin, NDK r6b. The Android.mk references
I have an Android NDK project. Windows 7, Cygwin, NDK r6b. The Android.mk references
I have the following code as my Android.mk in my project/jni folder. folder libA
I have a C++ codebase which is used by our Android project via JNI
I have an android application which uses jni and I'm trying to automate build
I have built OpenSSL for Android(using ndk-build) and have linked it to my program.
I have compiled a JNI library for Android with the NDK that statically links
I have a project organized as follow: project/jni/Android.mk project/jni/libA/Android.mk project/jni/libB/Android.mk project/lib/armeabi/libA.so project/lib/armeabi/libB.so My libA
I have Android pet-project DroidIn which utilizes HttpClient 4 (built into Android) to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.