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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:38:48+00:00 2026-06-17T20:38:48+00:00

I am attempting to compile an Android-9 project that calls Android NDK functions (such

  • 0

I am attempting to compile an Android-9 project that calls Android NDK functions (such as “AAsset_close”) by running “ndk-build” via the Cygwin terminal, but the “ndk-build” command returns an error message, stating that it is unable to find the function definitions.

The error messages from “ndk-build” are as follows:

[Android NDK path]/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: [project folder]/static library: in function [function name]:[file name]:39: error: undefined reference to ‘AAsset_close’

etc.

My “Android.mk” file is as follows:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE    := <name of project>
LOCAL_C_INCLUDES := <folders where header files are located>
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O2 -Wall -D__ANDROID__ -DtyANDROID
LOCAL_CPPFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O2 -Wall -D__ANDROID__ -DtyANDROID
LOCAL_LDLIBS := -lm -lEGL -lGLESv2 -llog -lz -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue

LOCAL_ARM_MODE  := arm  

LOCAL_SRC_FILES := <source files>

include $(BUILD_STATIC_LIBRARY)
...

My “Application.mk” makefile is as follows:

APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-9

According to the “nm” Unix command, this function is defined within the Android NDK library “libandroid.so”, which is present in the NDK path for all target platforms. As demonstrated above, I have included “-landroid” to the “LOCAL_LDLIBS” macro, which should allow me to link against that library. What else do I need to do to fix this compile error?

  • 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-17T20:38:49+00:00Added an answer on June 17, 2026 at 8:38 pm

    You show the Android.mk that builds a static library, at this step the linker is not called, threfore $(LOCAL_LDLIBS) is ignored. You probably have another Android.mk or a different section, where you have

    include $(BUILD_SHARED_LIBRARY)  
    

    Please check, -landroid is probably missing in that section.

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

Sidebar

Related Questions

I am attempting to compile some code, but am running into some problems that
I am attempting to build my android project using ant (it runs fine in
I am attempting to compile my C code using Android NDK. I downloaded and
While attempting to cross-compile ICU using android-ndk-r7 in Linux, the following error occurs after
When attempting to compile my C# project, I get the following error: 'C:\Documents and
I am attempting to compile JavaDocs with: mvn javadoc:aggregate I keep getting errors such
I'm attempting to compile some C# with gmcs version 2.11.0 that includes System.Tuple. Supposedly
In attempting to compile ICU49 using Android NDKv7b, I ran into the following: /home/tim/icu49/icu/source/common/putil.cpp:
I'm attempting to setup my Android project in IntelliJ. I've never used it before,
I am attempting to compile a list of Android phones which can be put

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.