Solve the problem that the android jni project will delete other so files

Source: Internet
Author: User

Solve the problem that the android jni project will delete other so files

During Android project development, jni is used in the project, and C/C ++ is used to write its own so library. debugging and running are all normal. The Android. mk file code is as follows:

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE:=observerLOCAL_SRC_FILES:=observer.cLOCAL_C_INCLUDES:= $(LOCAL_PATH)/includeLOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -lloginclude $(BUILD_SHARED_LIBRARY)

If we need to introduce other third-party so libraries to libs/armeabi, we will find that the third-party so library we just joined has been deleted during project compilation and running.

In this case, you only need to adjust it as follows:
1. Create the directory "prebuilt" in jni (other names can also be called)
2. Modify the Android. mk file and add our third-party so library to it. The added content of Android. mk on me is as follows:

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := tpnsSecurityLOCAL_SRC_FILES := prebuilt/libtpnsSecurity.soinclude $(PREBUILT_SHARED_LIBRARY)include $(CLEAR_VARS)LOCAL_MODULE := tpnsWatchdogLOCAL_SRC_FILES := prebuilt/libtpnsWatchdog.soinclude $(PREBUILT_SHARED_LIBRARY)include $(CLEAR_VARS)LOCAL_MODULE:=observerLOCAL_SRC_FILES:=observer.cLOCAL_C_INCLUDES:= $(LOCAL_PATH)/includeLOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -lloginclude $(BUILD_SHARED_LIBRARY)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.