Android studio doesn't appear to be reading .mk files

I am using Android Studio 1.3 with the experimental ndk plugin enabled. I am trying to compile Box2d by placing the Box2d folder into the jni folder. I have and in there as well. Whenever I try to compile Android studio spits out errors that the header files cannot be found. It seems that no matter what I do to the .mk files nothing changes. It's like they are not even being read. Does Android studio read .mk files?

LOCAL_PATH:=$(call my-dir)
$(info $(LOCAL_PATH))
    Collision \
    Collision/Shapes \
    Common \
    Dynamics \
    Dynamics/Contacts \
    Dynamics/Joints \
    Particle \

include $(LOCAL_PATH)/

# Conditionally include libstlport (so include path is added to CFLAGS) if
# it's not being built using the NDK build process.
define add-stlport-includes
$(eval \
  ifeq ($(NDK_PROJECT_PATH),)
  include external/stlport/

# Configure common local variables to build box2d adding $(1) to the end of the
# build target's name.
define box2d-module
$(eval \

# Execute a shell command relative to this module's directory.
define execute-local
$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) ; eval "$(1)"))

# Configure local variables to build box2d adding $(1) to the end of the
# build target's name.
define box2d-build
$(eval \
  $$(call box2d-module,$(1))
    $(subst $(LOCAL_PATH)/,,\
      $(foreach source_dir,$(source_directories),\
        $(foreach extension,$(b2_extensions),\
          $(wildcard $(LOCAL_PATH)/Box2D/$(source_dir)/*.$(extension)))))
    Box2D/Box2D.h \
    $(subst $(LOCAL_PATH)/,,\
      $(foreach source_dir,$(source_directories),\
        $(wildcard $(LOCAL_PATH)/Box2D/$(source_dir)/*.h)))
  LOCAL_CFLAGS:=$(if $(APP_DEBUG),-DDEBUG=1,-DDEBUG=0) $(b2_cflags)
  $$(call add-stlport-includes))

# --- libliquidfun ---
# Build shared library.
include $(CLEAR_VARS)
$(call box2d-build,)

# --- libliquidfun_static ---
# Build static library.
include $(CLEAR_VARS)
$(call box2d-build,_static)


no, Android Studio doesn't read *.mk files.

It generates Makefiles automatically for all your source files that are under jni/, by following the configuration you can do inside build.gradle.

You can try making box2d compile this way. You'll have to write a configuration like this one:

android.ndk {
    stl = stlport_static
    cppFlags += "-I${file("src/main/jni/Box2D/Collision")}".toString() // extra includes

Else, if you want your Makefiles to be considered, you can call ndk-build yourself. Set this inside your build.gradle so it will not try to compile your code, and it will get your .so files from src/main/libs/:

    main.jni {
        source {
            srcDirs = ['src/main/none'] // [] could be set instead but will disable even symbol resolution inside the editor
    main.jniLibs {
        source {
            srcDirs = ['src/main/libs']

Need Your Help

Restore SQL Server 2008 DB *to* SQL Server 2005

sql-server-2005 sql-server-2008

Got myself in a bit of a pickle here ... working on a CMS project, under the assumption that sql server 2008 was greenlighted as the db of choice. Well it wasn't, we now have to backport all of our

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.