android 中缺少共享库。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2283398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Shared library missing in android.
提问by Praveen
02-18 00:02:08.432: ERROR/PackageManager(57): Package com.example.brown requires unavailable shared library com.google.android.maps; failing!
02-18 00:02:08.432: ERROR/PackageManager(57): Package com.example.brown requires unavailable shared library com.google.android.maps; failing!
I got this exception in logcat.
我在 logcat 中遇到了这个异常。
Can anyone guide me?
任何人都可以指导我吗?
回答by Jeremy Logan
As CommonsWare said, your emulator is missing the library. The Google Maps Library's documentation's Overview pagehas info on how to create the right kind of virtual device for the emulator. The gist is:
正如 CommonsWare 所说,您的模拟器缺少该库。Google Maps Library 文档的概览页面包含有关如何为模拟器创建正确类型的虚拟设备的信息。要点是:
Launch the AVD Manager by using the android command without any options. If you are developing in Eclipse/ADT, you can also access the tool from Window > Android SDK and AVD Manager.
- Click the "New" button to begin creating a new AVD.
- In the dialog that appears, specify a name for the AVD and select the system image target that you want the AVD to use. Select one of the "Google APIs (Google Inc.)" targets, making sure to choose a version whose API Level matches the android:minSdkVersion attribute in your application's manifest, as described above.
- Configure the other options and then click "Create AVD".
Once you've finished creating the AVD, you can run it from the AVD Manager UI or you can use the emulator's command-line interface. If you are developing in Eclipse, you can configure a Run Configuration to start the AVD and install your application on it.
For more information about AVDs, see Android Virtual Deviceson the Android Developers site.
使用不带任何选项的 android 命令启动 AVD 管理器。如果您在 Eclipse/ADT 中进行开发,您还可以从 Window > Android SDK 和 AVD Manager 访问该工具。
- 单击“新建”按钮开始创建新的 AVD。
- 在出现的对话框中,指定 AVD 的名称并选择您希望 AVD 使用的系统映像目标。选择“Google API (Google Inc.)”目标之一,确保选择 API 级别与应用程序清单中的 android:minSdkVersion 属性匹配的版本,如上所述。
- 配置其他选项,然后单击“创建 AVD”。
完成创建 AVD 后,您可以从 AVD 管理器 UI 运行它,也可以使用模拟器的命令行界面。如果您在 Eclipse 中进行开发,您可以配置一个运行配置来启动 AVD 并在其上安装您的应用程序。
有关 AVD 的更多信息,请参阅Android 开发人员站点上的 Android虚拟设备。
回答by Nys
I had the similar problem on a real device. After a loot of googling I found this answer
我在真实设备上遇到了类似的问题。经过一番谷歌搜索后,我找到了这个答案
fixing missing shared library. It turns out that on some custom roms the comp.google.android.map library is missing, you have to install it manually.
修复丢失的共享库。事实证明,在某些自定义 rom 上缺少 comp.google.android.map 库,您必须手动安装它。
- download googleapps
- extract two files
- system/etc/permissions/com.google.android.maps.xml
- system/framework/com.google.android.maps.jar
- remount the /system filesystem rw (mount -o rw,remount /system)
- copy the files in
- do a chmod 644 on them
- reboot
- 下载 googleapps
- 提取两个文件
- system/etc/permissions/com.google.android.maps.xml
- 系统/框架/com.google.android.maps.jar
- 重新挂载 /system 文件系统 rw (mount -o rw,remount /system)
- 将文件复制到
- 对它们执行 chmod 644
- 重启
回答by jfritz42
This error occurred to me on an actual device, not an AVD like the other answers. In my case I was running on a Nexus S with a custom ROM that did not have Google Maps installed.
这个错误发生在我的实际设备上,而不是像其他答案那样的 AVD。就我而言,我在带有自定义 ROM 的 Nexus S 上运行,该 ROM 未安装 Google 地图。
I have read elsewherethat the com.google.android.maps shared library is bundled with the ROM itself and is not bundled as part of an APK.
我在其他地方读到com.google.android.maps 共享库与 ROM 本身捆绑在一起,而不是作为 APK 的一部分捆绑在一起。
Therefore the solution for me was to revert to the stock ROM which had Google Maps installed.
因此,我的解决方案是恢复到安装了谷歌地图的库存 ROM。
BTW, the title of this thread refers to an error that is found in the DDMS LogCat. The first error most users will see (before checking LogCat) will be in the console of Eclipse:
顺便说一句,该线程的标题指的是在 DDMS LogCat 中发现的错误。大多数用户会看到的第一个错误(在检查 LogCat 之前)将出现在 Eclipse 的控制台中:
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Please check logcat output for more details.
回答by CommonsWare
Your emulator is missing the Google APIs. Create a new AVD that contains the Google APIs, and this error should go away.
您的模拟器缺少 Google API。创建一个包含 Google API 的新 AVD,此错误应该会消失。
回答by Stefan Endrullis
As jfritz42 I got this error on a real device with a custom ROM (Cyanogenmod). The error was caused by the fact that I did not install the Google Apps package, since it contains a lot of apps that just annoy me. However, there is a solution how to install the google.maps library without massing up your system with the 19 Google Apps in this package. Just download the package (zip file) and remove all .apk files from system/app in this zip. Afterwards, you can install the zip by using the ROM Manager or via the recovery mode. Then you should have the maps library installed on your system. The Google Apps included in this package (e.g. the Maps app) can be installed separately afterwards.
作为 jfritz42,我在带有自定义 ROM(Cyanogenmod)的真实设备上遇到此错误。该错误是由于我没有安装Google Apps 包造成的,因为它包含许多让我烦恼的应用程序。但是,有一个解决方案如何安装 google.maps 库,而无需使用此软件包中的 19 个 Google Apps 来集中您的系统。只需下载包(zip 文件)并从系统/应用程序中删除此 zip 中的所有 .apk 文件。之后,您可以使用 ROM 管理器或通过恢复模式安装 zip。然后你应该在你的系统上安装了地图库。此软件包中包含的 Google Apps(例如地图应用程序)可以在之后单独安装。
回答by Tapa Save
In case with real device try remove from manifest file:
如果使用真实设备,请尝试从清单文件中删除:
<uses-library android:name="com.google.android.maps" />
<uses-library android:name="com.google.android.maps" />
回答by TwoByteHero
fiXedd (see above) is correct.
fiXedd(见上文)是正确的。
You can edit devices you have already created or create a new one. When you create or edit a device inside the AVD Manager, instead of selecting this kind of version target:
您可以编辑已创建的设备或创建新设备。当您在 AVD 管理器中创建或编辑设备时,不要选择这种版本目标:
Android x.x.x - API Level x
Android xxx - API 级别 x
Simply use this kind instead:
只需使用这种代替:
Google APIs (Google Inc.) - API Level x
Google API (Google Inc.) - API 级别 x
回答by John J Smith
I've experienced this error after the AVD was set up properly and working okay. The AVD was still using the Google APIs and I could see the reference to the maps library in Eclipse. The only way I found to resolve this was to delete the AVD and create a new one, as advised by fiXedd.
在正确设置 AVD 并正常工作后,我遇到了此错误。AVD 仍在使用 Google API,我可以在 Eclipse 中看到对地图库的引用。我发现解决此问题的唯一方法是按照 fiXedd 的建议删除 AVD 并创建一个新的 AVD。