java - Android makefile include dynamic library runtime error -


i trying write android app making use of jni.

i have 1 activity file instantiates class makes call jni function.

my cpp code built fine , put @ location libs/armeabi/libapplist.so

my java file this.

package com.example.applist;  public class backend {     static {          try {             system.loadlibrary("applist");         } catch(exception e) {             log.d("backend","caught exception" + e);         }      }              public native int creategroup() ; } 

and makefile below

local_path:= $(call my-dir) include $(clear_vars)  local_module_tags := optional  #only compile source java files in apk.  local_src_files := $(call all-java-files-under, src)  local_package_name := applist  local_certificate := platform  include $(build_package) local_prebuilt_libs := libs/armeabi/libapplist.so include $(build_multi_prebuilt) 

i instantiating class main activity class testing. (new backend();) receive runtime error. can explain doing incorrect? new learner this.

# edit: figured out how write correct makefile. here is:

local_path:= $(call my-dir)  include $(clear_vars) local_module_tags := optional # compile source java files in apk. local_src_files := $(call all-java-files-under, src) local_required_modules := libapplistback local_shared_libraries := libapplistback local_package_name := applistnew local_certificate := platform include $(build_package)  include $(clear_vars) local_module_tags := optional local_prebuilt_libs := libapplistback:libs/armeabi/libapplistback.so include $(build_multi_prebuilt)  #include $(call all-makefiles-under,$(local_path)) 

however c code have build through ndk , make .so file. if uncomment last line other makefile executed not able find out .cpp file in same directory. error no rule make '/backend.cpp'. can that?

it looks this:

local_path := $(call my-dir)   include $(clear_vars)   local_module    := applistback local_ldlibs := -l$(sysroot)/usr/lib -llog  local_src_files := backend.cpp local_c_includes += $(jni_h_include) local_module_tags := optional #local_prelink_module := false  include $(build_shared_library)   

don't compile java in makefile (android.mk). should build java part of app ant. easier - use gui environment google's adt bundle. can run ndk-build step you.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -