I have a prebuild third party C library libliveplay.so, I want to add it to apk. I put it under
libs/armeabi
libs/armeabi-v7a
and my android.mk file is like:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := RtspPlayer
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
LOCAL_SHARED_LIBRARIES := libliveplay
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
but it can't add the so into apk with this method, could anyone help?
When apk build out, I install it on my device, and runtime error happened:
E/AndroidRuntime( 4660): FATAL EXCEPTION: main
E/AndroidRuntime( 4660): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 4660): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 4660): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 4660): at android.app.Instrumentation.newActivity(Instrumentation.java:1064)
E/AndroidRuntime( 4660): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
E/AndroidRuntime( 4660): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime( 4660): at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime( 4660): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime( 4660): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4660): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4660): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 4660): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4660): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4660): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 4660): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 4660): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 4660): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load liveplay from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.mrlans.play-2.apk,libraryPath=/data/app-lib/com.mrlans.play-2]: findLibrary returned null
E/AndroidRuntime( 4660): at java.lang.Runtime.loadLibrary(Runtime.java:365)
E/AndroidRuntime( 4660): at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime( 4660): at com.mrlans.play.MediaActivity.<clinit>(MediaActivity.java:152)
E/AndroidRuntime( 4660): ... 15 more
The error indicated that the so did not include in the apk, it didn't install into system when apk installed. please help.