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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:46:04+00:00 2026-06-09T07:46:04+00:00

I’m new to Android and am trying to create a simple SDK+NDK concept. I

  • 0

I’m new to Android and am trying to create a simple SDK+NDK concept. I followed the below steps:

  1. Download NDK
  2. Extract zip file
  3. Create new android project.
  4. Create new folder jni under project.
  5. Define UI as needed.
  6. Create a java file to call all the native methods. Declare all those methods with “native” prefix. Have static block to load library using system.loadLibrary("").
  7. Create corresponding header file using javah -jni filename
  8. Move the generated filename.h file to jni folder.
  9. Write c file that includes the .h file and implements the methods in .h file and saved it.
  10. Create mk file,with following content:

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

  11. Go to the project folder in command prompt
  12. Give <ndkfolder>/ndk-build
  13. .so file will be generated

But I got stuck in the “12” point with the following error:

**"Compile thumb : com_cts_c2dmclient_NativeLib <= com_cts_c2dmclient_NativeLib.c
jni/com_cts_c2dmclient_NativeLib.c:3:40: fatal error: com_cts_c2dmclient_NativeL
ib: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/com_cts_c2dmclient_NativeLib/com_cts_c2dmclien
t_NativeLib.o] Error 1**

Note: The .h file is created successfully.

My com_exampleservice_NativeLib.c file

#include "stdio.h"
#include "malloc.h"
#include <com_exampleservice_NativeLib.h>

JNIEXPORT jint JNICALL Java_com_exampleservice_NativeLib_loop
  (JNIEnv * env,jobject obj,jint v1, jint v2){
    int loop;
    unsigned long int *array;
if(v2 == 0){
    array = (unsigned long int *)malloc(v1 * sizeof(unsigned long int));}
else if(v2 == 1)
{
array = realloc(array,sizeof(array)+v1);
}
else{
}
    array[0] = 1;
    array[1] = 1;
    for (loop = 2; loop < v1; loop++) {
        array[loop] = array[loop - 1] + array[loop - 2];
    }
    for (loop = 0; loop < v1; loop++) {
    }
if(v2 == 2)
{
free(array);
}
return 0;
}
  • 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-09T07:46:06+00:00Added an answer on June 9, 2026 at 7:46 am

    Your Android.mk file does not look good in your question.

    Make sure that the com_exampleservice_NativeLib.h file does exist in your jni directory near your c file.

    It may be necessary to add directories to the include path, like

      LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
    

    Note that this $(LOCAL_C_INCLUDES) must be a list of absolute paths, not like $(LOCAL_SRC_FILES) which is $(LOCAL_PATH)-based.

    Another note is that in your com_exampleservice_NativeLib.c file the use of #include directive ornamenation is not correct. It should go

    #include <stdio.h>
    #include <malloc.h>
    #include "com_exampleservice_NativeLib.h"
    

    See What is the difference between #include <filename> and #include "filename"? for detailed explanation.

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.