gpt4 book ai didi

android - 使用两个 .so 文件启动项目时崩溃

转载 作者:行者123 更新时间:2023-11-30 04:11:56 25 4
gpt4 key购买 nike

我尝试构建我的项目,它有两个 .so 文件:libTheGame.soliblua.so两者都在 apk 中,但是当我启动它时项目崩溃:

Caused by: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.piotrekb.theGame/lib/libTheGame.so

我可以同时构建和午餐项目,但没有将 lua 库添加到 TheGame:/但是当我添加

LOCAL_SHARED_LIBRARIES := lua

崩溃发生了:/

这是我的 android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := lua
LOCAL_SRC_FILES := ./Libs/lua-5.2.0/src/llex.c \
./Libs/lua-5.2.0/src/lapi.c \
./Libs/lua-5.2.0/src/loadlib.c \
./Libs/lua-5.2.0/src/lvm.c \
./Libs/lua-5.2.0/src/lundump.c \
./Libs/lua-5.2.0/src/lauxlib.c \
./Libs/lua-5.2.0/src/lparser.c \
./Libs/lua-5.2.0/src/lgc.c \
./Libs/lua-5.2.0/src/lobject.c \
./Libs/lua-5.2.0/src/lstrlib.c \
./Libs/lua-5.2.0/src/lbaselib.c \
./Libs/lua-5.2.0/src/ldebug.c \
./Libs/lua-5.2.0/src/lmem.c \
./Libs/lua-5.2.0/src/ltable.c \
./Libs/lua-5.2.0/src/loslib.c \
./Libs/lua-5.2.0/src/ldo.c \
./Libs/lua-5.2.0/src/ltablib.c \
./Libs/lua-5.2.0/src/liolib.c \
./Libs/lua-5.2.0/src/ldump.c \
./Libs/lua-5.2.0/src/ldblib.c \
./Libs/lua-5.2.0/src/lstate.c \
./Libs/lua-5.2.0/src/lctype.c \
./Libs/lua-5.2.0/src/lcode.c \
./Libs/lua-5.2.0/src/lcorolib.c \
./Libs/lua-5.2.0/src/lzio.c \
./Libs/lua-5.2.0/src/lmathlib.c \
./Libs/lua-5.2.0/src/lbitlib.c \
./Libs/lua-5.2.0/src/ltm.c \
./Libs/lua-5.2.0/src/lstring.c \
./Libs/lua-5.2.0/src/lopcodes.c \
./Libs/lua-5.2.0/src/linit.c \
./Libs/lua-5.2.0/src/lfunc.c
LOCAL_LDLIBS := -lm
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)



include $(CLEAR_VARS)
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)/Libs/cml-1_0_2 -I$(STLPORT_BASE)/stlport
LOCAL_MODULE := TheGame

LOCAL_SRC_FILES := ./UISystem/UISystem.cpp ./ScriptSystem/ScriptSystem.cpp ./World3D/World3D.cpp ./ResourceSystem/ResourceSystem.cpp ./Renderer/Image.cpp \
./Renderer/Model3D.cpp ./LevelSystem/LevelSystem.cpp ./Renderer/ShaderProgram.cpp ./Common/Common.cpp ./Common/Engine.cpp ./Common/InDataBunch.cpp \
./Common/OutDataBunch.cpp ./Input/Input.cpp ./Game/Game.cpp ./Renderer/GL20Renderer.cpp \
./EntitySystem/EntitySystem.cpp TheGame.cpp
LOCAL_LDLIBS := -lm -llog -landroid -lGLESv2 -lEGL
LOCAL_SHARED_LIBRARIES := lua ##this line causes crash
LOCAL_STATIC_LIBRARIES := android_native_app_glue
LOCAL_CFLAGS+=$(LOCAL_C_INCLUDES)
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)

你知道我该如何处理这个 :/吗?我调查了类似的问题,但它们对我没有帮助。

最佳答案

我遇到了非常相似的问题。最后结束了在单独的 mk 文件中编译库。

我认为这个答案可能对您有所帮助。 Android NDK linking

关于android - 使用两个 .so 文件启动项目时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10727589/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com