So, I built this project based on a PDF reader (MuPDF). For this, I used ndk-build. The name of this project is SelectPDFActivity. I know that it was built correctly because I see the .so file inside my libs / armrabi-v7a / THISISTHEFILE.so . My question is, how to properly do this library project project and run it from another project?
I tried marking it as a library project and adding it to my main project building path, but I get
Please note that I am using Mupdf-1.5 (the latter currently)
ExpressionInitializerError, Failed to load library, FindLibrary NUll returned errors
so what should i do?
my library name is libmupdf. Notice I'm new to android-ndk. I do not have a jni folder in my main project, only in the library project. This is a complete mistake.
06-16 17: 51: 27.680: E / AndroidRuntime (5673): FATAL EXCEPTION: main 06-16 17: 51: 27.680: E / AndroidRuntime (5673): java.lang.ExceptionInInitializerError 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at java.lang.Class.newInstanceImpl (native Method) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at java.lang.Class.newInstance (Class.java:1319) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): with android.app.Instrumentation.newActivity (Instrumentation.java:1025) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at android. app.ActivityThread.performLaunchActivity (ActivityThread.java:1871) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:1981) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at android.app.ActivityThread.access $ 600 (ActivityThread.java:123) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): with android.app.ActivityThread $ H. handleMessage (ActivityThread.java:1147) 06-16 17: 51: 27.680: E / AndroidRu ntime (5673): at android.os.Handler.dispatchMessage (Handler.java:99) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): when android.os.Looper.loop (Looper.java:137 ) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): with android.app.ActivityThread.main (ActivityThread.java:4424) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): with java .lang.reflect.Method.invokeNative (native method) 06-16 17: 51: 27.680: E / Android Runtime (5673): with java.lang.reflect.Method.invoke (Method.java∗11) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:825) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): at com .android.internal.os.ZygoteInit.main (ZygoteInit.java∗92) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): with dalvik.system.NativeStart.main (native method) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): caused by: java.lang.UnsatisfiedLinkError: Failed to load libmu pdf: findLibrary returns null 06-16 17: 51: 27.680: E / AndroidRuntime (5673): when java.lang.Runtime.loadLibrary (Runtime.java data65) 06-16 17: 51: 27.680: E / AndroidRuntime (5673 ): when java.lang.System.loadLibrary (System.java∗35) 06-16 17: 51: 27.680: E / AndroidRuntime (5673): when com.mainpackage.MainActivity. (MainActivity.java:44)
Please help me by killing me for a couple of days. Thanks in advance.
this is my Android.mk:
LOCAL_PATH := $(call my-dir) TOP_LOCAL_PATH := $(LOCAL_PATH) MUPDF_ROOT := ../.. ifdef NDK_PROFILER include android-ndk-profiler.mk endif include $(TOP_LOCAL_PATH)/Core.mk include $(TOP_LOCAL_PATH)/ThirdParty.mk include $(CLEAR_VARS) LOCAL_C_INCLUDES := \ jni/andprof \ $(MUPDF_ROOT)/include \ $(MUPDF_ROOT)/source/fitz \ $(MUPDF_ROOT)/source/pdf LOCAL_CFLAGS := LOCAL_MODULE := mupdf LOCAL_SRC_FILES := mupdf.c LOCAL_STATIC_LIBRARIES := mupdfcore mupdfthirdparty ifdef NDK_PROFILER LOCAL_CFLAGS += -pg -DNDK_PROFILER LOCAL_STATIC_LIBRARIES += andprof else endif LOCAL_LDLIBS := -lm -llog -ljnigraphics ifdef SSL_BUILD LOCAL_LDLIBS += -L$(MUPDF_ROOT)/thirdparty/openssl/android -lcrypto -lssl endif include $(BUILD_SHARED_LIBRARY)
Here is a snapshot of my projects. There are two dedicated projects that they talk about, with the ChoosePDFActivity project being a library project.
Well, something like this will work for my case: Is it possible for the whole project to be created in my final build? I just need to convey ONE intention of this from my main project, and everything else will be handled by the ChoosePdf project ....
PS I noticed that there is only armeabi-v7a. So, is there a way to create mupdf for other architectures as well
EDIT For those who want to have PDF rendering in android, Android L (finally) got apis to make their own PDF rendering possible.
c ++ android eclipse android-intent android-ndk
harvey_slash
source share