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 8843759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:18:45+00:00 2026-06-14T11:18:45+00:00

Is there a way to force the Android NDK to rebuild a particular library

  • 0

Is there a way to force the Android NDK to rebuild a particular library when changing build configurations in Eclipse?

I am building building an Android Project using the Android NDK to build C++ libraries. I am using Eclipse with the Sequoyah plugin. Everything is set up and works well.

However, I have run into an issue with build configurations. You can manage build configurations by right-clicking the project->properties and then go to the C/C++ Build section. This allows you to create the traditional Debug, and Release builds that most C++ libraries depend on in some way.

Here is an example of my “Debug” configuration:

V=1 NDK_DEBUG=1 NDK_APPLICATION_MK=config/debug/Application.mk

These work well, except that when I switch back and forth between configurations, it does not trigger a rebuild of the libraries I am building. This would be expected for something like Visual Studio where each build config dumps to a different directory, but in Eclipse everything gets dumped to the same directory. I am forced to actually change relevant source files to trigger a rebuild. So what ends up happening is I end up running (for instance) in the Debug configuration but linking to libraries that were built in Release.

So my question is: is there a way to force the NDK to rebuild a library when changing configurations? I am aware of the -B command I can add, but that rebuilds everything, everytime. I would be OK rebuilding every time, if I could do it for just one specific library (in this case libBootInfo).

Here is what my root Android.mk file looks like:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game$(MY_BUILD_CONFIG_EXTENSION)

# Include files are relative to the NDK root directly (fix by prepending with $(LOCAL_PATH))
# Source files are relative $(LOCAL_PATH)

#LOCAL_LDLIBS    := -landroid

# Add all source file names to be included in lib separated by a whitespace
LOCAL_SRC_FILES :=  ../../../../../../engine/code/main/mainandroid.cpp

# Module dependencies are expressed with LOCAL_STATIC_LIBRARIES and LOCAL_SHARED_LIBRARIES.
# we're building the "main" entry point, so it doesn't depend on much
LOCAL_STATIC_LIBRARIES := libDebug$(MY_BUILD_CONFIG_EXTENSION) libCore$(MY_BUILD_CONFIG_EXTENSION)

include $(BUILD_SHARED_LIBRARY)

$(call import-module,libBdCore)
$(call import-module,libDebug)

##################################################################
## In addition to the core game library, we also build another
## *.so file here: "libBootInfo". This very small library is used
## by Java to find out which version of game to load based on
## the current build configuration.
##

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libBootInfo

# Add all source file names to be included in lib separated by a whitespace
# TODO: This path is relative to "android-ndk\build\core" which seems
#       different from the LOCAL_SRC_FILES in game above. It seems like
#       the build process leaves us in a different directory than we started.
#       We make need to look into a way to make sure that this path always 
#       works regardless of what came before it.
#
LOCAL_SRC_FILES := ../../../../engine/code/main/bootinfo.cpp

include $(BUILD_SHARED_LIBRARY)
  • 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-14T11:18:46+00:00Added an answer on June 14, 2026 at 11:18 am

    I was never able to get this working quite right. In the end I just created a batch file which wrote out an empty source file. That batch file is executed as part of a build step in Eclipse. I then included that source file as part of my library. Since the time stamp changes every time I build, it tricks ndk into rebuilding that library every time. I make sure that library is kept small and most code lives in other libraries, making the build time quite short.

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

Sidebar

Related Questions

I have been using Cygwin to build my Android library using the NDK's ndk-build
Is there a way in Android to force output through the phone speaker, even
Is there a way to use in my android project newer version of HttpClient
Is there a way to force C# compiler, visual studio 2010, to call a
Is there a way to force VS to use Unicode always, instead of weird
is there some way to force the gridview's pager to show up, even when
Is there a way to force the client to update its local svn configuration
Is there any way to force a Route to be executed, only if all
Is there any way to force a browser to refresh or empty it's cache,
Is there a way to force classes in Java to have public static final

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.