我如何得到我的.so库复制到Android设备? [英] How do I get my .so libraries copied to the Android device?

查看:139
本文介绍了我如何得到我的.so库复制到Android设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要总结一下在同一行:并非所有我的的库/ armeabi / *这样文件复制到设备上,当我运行我的应用程序。我会尽力解释。

To sum it up in one line: Not all of my libs/armeabi/*.so files are copied to the device when I run my application. I'll try to explain.

我试图让FFmpeg的Andr​​oid版上,因此有NDK的结构如下:

I'm trying to get ffmpeg onto Android and therefore have the following structure for the NDK:

jni
├── Android.mk
├── bambuser_ffmpeg
│   ├── Android.mk
│   ├── libavcodec.so
│   ├── libavcore.so
│   ├── libavdevice.so
│   ├── libavfilter.so
│   ├── libavformat.so
│   ├── libavutil.so
│   └── libswscale.so
└── video
    ├── Android.mk
    ├── at_ac_univie_gameclient_video_VideoGLSurfaceView.c
    ├── at_ac_univie_gameclient_video_VideoGLSurfaceView.h
    └── at_ac_univie_gameclient_video_VideoGLSurfaceView_GLRenderer.h

Android.mk文件

Android.mk bambuser_ffmpeg 文件说:

include $(CLEAR_VARS)
LOCAL_MODULE := bambuser-libavcodec
LOCAL_SRC_FILES := libavcodec.so
include $(PREBUILT_SHARED_LIBRARY)
# and so on, for all of the above .so files

第二个'Android.mk文件有以下内容:

The second `Android.mk file has the following:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := ffmpeg
LOCAL_STATIC_LIBRARIES := bambuser-libavcodec bambuser-libavcore bambuser-libavdevice bambuser-libavfilter bambuser-libavformat bambuser-libavutil bambuser-libswscale
LOCAL_SRC_FILES := at_ac_univie_gameclient_video_VideoGLSurfaceView.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../bambuser_ffmpeg/
LOCAL_LDLIBS    := -L$(LOCAL_PATH)/../bambuser_ffmpeg -lavcodec -lavcore -lavdevice -lavfilter -lavformat -lavutil -lswscale -llog -lz -lGLESv1_CM

include $(BUILD_SHARED_LIBRARY)

输出

所以,当我运行 ./ NDK的构建,我收到此输出。看起来不错,不是吗?

Output

So, when I run ./ndk-build, I receive this output. Looks fine, does it?

Prebuilt       : libavcodec.so <= jni/bambuser_ffmpeg/
Install        : libavcodec.so => libs/armeabi/libavcodec.so
Prebuilt       : libavcore.so <= jni/bambuser_ffmpeg/
Install        : libavcore.so => libs/armeabi/libavcore.so
Prebuilt       : libavdevice.so <= jni/bambuser_ffmpeg/
Install        : libavdevice.so => libs/armeabi/libavdevice.so
Prebuilt       : libavfilter.so <= jni/bambuser_ffmpeg/
Install        : libavfilter.so => libs/armeabi/libavfilter.so
Prebuilt       : libavformat.so <= jni/bambuser_ffmpeg/
Install        : libavformat.so => libs/armeabi/libavformat.so
Prebuilt       : libavutil.so <= jni/bambuser_ffmpeg/
Install        : libavutil.so => libs/armeabi/libavutil.so
Prebuilt       : libswscale.so <= jni/bambuser_ffmpeg/
Install        : libswscale.so => libs/armeabi/libswscale.so
Install        : libffmpeg.so => libs/armeabi/libffmpeg.so

问题

当我运行我的Andr​​oid应用程序,它会尝试加载 libffmpeg.so 。当然,我的本地目录包含所有需要的库,因为他们建造/前复制:

Problem

When I run my Android application, it will try to load libffmpeg.so. Of course, my local libs directory contains all libraries needed, as they were built/copied before:

libs
└── armeabi
    ├── libavcodec.so
    ├── libavcore.so
    ├── libavdevice.so
    ├── libavfilter.so
    ├── libavformat.so
    ├── libavutil.so
    ├── libffmpeg.so
    └── libswscale.so

然而,设备本身上,这里只有我的 libffmpeg.so 文件。它位于 at.ac.univie.gameclient / lib中/ libffmpeg.so ,并自动复制那里。在哪里其他的.so 文件,我怎么让他们到的设备?

However, on the device itself, there's only my libffmpeg.so file. It resides in at.ac.univie.gameclient/lib/libffmpeg.so and was copied there automatically. Where are the other .so files and how do I get them to the device?

<子>另外,刚手动复制没有我期望的解决方案,效果显着。

推荐答案

您绝对确保你所有的库上传应用程序之前在那里。是的,我看到你写的,他们是有,但在生成JNI项目它删除库目录中的所有现有文件。你把它上传只是为了仔细检查之前,所以刷新。

Are you absolutely sure that all your libraries are there before uploading the app. Yes i saw you wrote that they are there but when you build the jni project it deletes all your existing files in libs dir. So refresh before you upload it just to double check.

这篇关于我如何得到我的.so库复制到Android设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆