Dalvik的是寻找具有“0.0”扩展名.so文件 - 为什么? [英] Dalvik is looking for .so file with '.0' extension - why?

查看:227
本文介绍了Dalvik的是寻找具有“0.0”扩展名.so文件 - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始开发一个非常简单的Andr​​oid应用程序,它由三部分组成:

I have started developing a very simple Android application that consists of three parts:

  • Java应用程序本身
  • 在一个pre-内置共享库(我们称之为 libfoo的
  • 使用了pre建库的另一共享库(我们称之为 libfoowrapper
  • the Java application itself
  • a pre-built shared library (we'll call it libfoo)
  • another shared library that uses the pre-built library (we'll call it libfoowrapper)

文件系统看起来是这样的:

The file system looks something like this:

jni
Android.mk
libfoo.so
foowrapper.c

Android.mk 文件包含以下内容:

The Android.mk file contains the following contents:

LOCAL_PATH := $(call my-dir)

#==============================

include $(CLEAR_VARS)

LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := libfoo.so

include $(PREBUILT_SHARED_LIBRARY)

#=========================

include $(CLEAR_VARS)

LOCAL_MODULE := foowrapper
LOCAL_SRC_FILES := foowrapper.c

LOCAL_SHARED_LIBRARIES := foo-prebuilt

include $(BUILD_SHARED_LIBRARY)

当我在Eclipse中构建应用程序,事情似乎做工精细 - 没有错误报告。但是,当我上传的应用程序,以我的三星体验(运行Android 4.0.4),我得到的日志中出现以下错误:

When I build the application in Eclipse, things seem to work fine - no errors are reported. However, when I upload the application to my Samsung Discover (running Android 4.0.4), I get the following error in the log:

03-05 21:20:27.859: E/AndroidRuntime(20324): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]:   102 could not load needed library 'libfoo.so.0' for 'libfoowrapper.so' (load_library[1091]: Library 'libfoo.so.0' not found)

为什么在Dalvik寻找 .so.0 文件,而不是一个的.so 文件?做什么样的变化,我需要让我的应用程序,以摆脱这种错误?

Why is the Dalvik looking for a .so.0 file instead of a .so file? What changes do I need to make to my app to get rid of this error?

推荐答案

至少在Linux世界中,每一个共享库有一个特殊的名字叫的soname 。该SONAME有preFIX LIB ,图书馆,短语的.so 中,后跟一个名字时间和递增每当界面的变化版本号(作为一个特殊的例外,最低级别的C库不与启动LIB )。一个完全合格的soname,包括为preFIX它在目录中;在一个工作系统完全合格的soname是简单地共享库的的真名的符号链接

At least in the Linux world, every shared library has a special name called the soname. The soname has the prefix lib, the name of the library, the phrase .so, followed by a period and a version number that is incremented whenever the interface changes (as a special exception, the lowest-level C libraries don't start with lib). A fully-qualified soname includes as a prefix the directory it's in; on a working system a fully-qualified soname is simply a symbolic link to the shared library's real name.

每一个共享库也有一个的真实姓名,这是包含实际库code中的文件名。实名增加了SONAME一个时期,一个小数目,另一个时期,以及版本号。最后一期,版本号是可选的。通过让你的设备号和版本号支持的配置控制确切地知道该库的版本(S)安装。需要注意的是,这些数字可能不一样,用于描述在文档库中的数字,虽然这并更加容易。

Every shared library also has a real name, which is the filename containing the actual library code. The real name adds to the soname a period, a minor number, another period, and the release number. The last period and release number are optional. The minor number and release number support configuration control by letting you know exactly what version(s) of the library are installed. Note that these numbers might not be the same as the numbers used to describe the library in documentation, although that does make things easier.

参考: Linux标准基础

编辑: 看来这不是一个罕见的问题,还没有看到任何真正的解决方案,但也许这将让你开始寻找一些对你有用。

It seems this is not an uncommon problem, haven't seen any real solutions to it, but perhaps this will get you started to finding something that works for you.

使用preBUILT_SHARED_LIBRARY时LOCAL_SRC_FILES问题 https://groups.google.com/forum/#​​!topic/android -ndk / _UhNpRJlA1k

Problem with LOCAL_SRC_FILES when using PREBUILT_SHARED_LIBRARY https://groups.google.com/forum/#!topic/android-ndk/_UhNpRJlA1k

创建为Android非版本共享库 的http://www.opengis.ch/2011/11/23/creating-non-versioned-shared-libraries-for-android/

Creating non-versioned shared libraries for android http://www.opengis.ch/2011/11/23/creating-non-versioned-shared-libraries-for-android/

图书馆libproj.so.0'未找到 https://groups.google.com/forum/?fromgroups =#!话题/ Android的NDK / ai3tu0XXs88

Library 'libproj.so.0' not found https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/ai3tu0XXs88

这篇关于Dalvik的是寻找具有“0.0”扩展名.so文件 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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