Wie jede Bibliothek in ndk-Anwendung

Vom dieses tutorial.

sehen, habe ich eine vorgefertigte statische Bibliothek mit Namen wie stackoverflow.a und es hat stackoverflow.h

jetzt will ich mit der Funktion, die statische Bibliothek in

ndk_demo.c //das tutorial hat diese Datei

für die innen ndk_demo.c ich habe

#include 'stackoverflow.h'  

Bearbeiten

inside `android-ndk-r7c`
         |
        apps
         |
        ndk_demo
         |
     -----------------
     |               |
   project          Application.mk
     |
--------------------
|                   |
all other           |
folder             jni
                    |  
-------------------------------------------------------------------
  |               |                     |          |              |
ndk_demo.c      stackoverflow.h        lib    com_marakana       Android.mk
                                        |      _NativeLib.h
                                        |
                             --------------------
                             |                   |
                          Android.mk          libstackoverflow.a

Nun Anwendung.mk

APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES      := ndk_demo stackover

Nun jni/Android.mk

include $(call all-subdir-makefiles)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := ndk_demo
LOCAL_SRC_FILES := ndk_demo.c
LOCAL_STATIC_LIBRARIES := stackover
include $(BUILD_SHARED_LIBRARY)

nun jni/lib/Android.mk

   LOCAL_PATH := $(call my-dir)
   include $(CLEAR_VARS)
   LOCAL_MODULE := stackover
   LOCAL_SRC_FILES := libstackoverflow.a
   include $(PREBUILT_STATIC_LIBRARY)
   LOCAL_PATH := $(call my-dir)

Nun von android-ndk-r7c Verzeichnis
ich Laufe

make APP=ndk_demo

zeigt es mir eine Fehlermeldung wie

Android NDK: Building for application 'ndk_demo'    
make: *** No rule to make target `build/core/ndk_demo.c', needed by `out/apps/ndk_demo/armeabi/objs/ndk_demo/ndk_demo.o'.  Stop.

warum das passiert bin ich nicht immer ?

wenn ich kommentieren

#include $(call all-subdir-makefiles)

diese von jni/Android.mk dann zeigt er folgenden Fehler

Android NDK: Building for application 'ndk_demo'    
Compile thumb  : ndk_demo <= ndk_demo.c
SharedLibrary  : libndk_demo.so
./out/apps/ndk_demo/armeabi/objs/ndk_demo/ndk_demo.o: In function `Java_com_marakana_NativeLib_hello':
/home/jeegar/android-ndk-r7c/apps/ndk_demo/project/jni/ndk_demo.c:10: undefined reference to `stackoverflowInit'
collect2: ld returned 1 exit status
make: *** [out/apps/ndk_demo/armeabi/libndk_demo.so] Error 1
InformationsquelleAutor Jeegar Patel | 2012-04-11
Schreibe einen Kommentar