简体   繁体   English

使用Google Maps API部署Android应用时出错

[英]Error Deploying an Android App Using Google Maps API

I'm attempting to run an Android app, that makes use of Google's map API, onto the Android simulator via the Eclipse plugin. 我正在尝试通过Eclipse插件在Android模拟器上运行一个利用Google Map API的Android应用。

Even though I have the Google APIs installed, when I created my initial project, the links to the API jars where not included. 即使安装了Google API,当我创建初始项目时,指向API jar的链接(未包括在内)也是如此。 So I copied maps.jar from android-sdk-linux/add-ons/addon-google_apis-google-16/libs into my project's libs folder, and that resolved all the reference errors. 因此,我从android-sdk-linux/add-ons/addon-google_apis-google-16/libs复制了maps.jar到我项目的libs文件夹中,这解决了所有参考错误。

However, when I go to "Run" (Ctrl+F11) my app on the simulator, it fails with the error Package com.mydomain.myapp requires unavailable shared library com.google.android.maps; failing! 但是,当我在模拟器上转到“运行”(Ctrl + F11)时,它失败,并显示以下错误: Package com.mydomain.myapp requires unavailable shared library com.google.android.maps; failing! Package com.mydomain.myapp requires unavailable shared library com.google.android.maps; failing!

I have several other jars in my libs folder, and I'm not getting any errors for those. 我的libs文件夹中还有其他几个jar,这些都没有出现任何错误。 Why isn't it copying over the maps.jar? 为什么不复制在maps.jar上? How do I resolve this error? 如何解决此错误?

按照Yawus的说明进行操作,然后执行以下操作:单击AVD Manager,然后突出显示您的虚拟设备并单击Edit,然后将Target更改为Google APIs (Google Inc.) - API Level XX

Are you targeting the Google APIs when you create your project? 创建项目时是否要定位Google API? Try this: 尝试这个:

  1. Right-click your project in the Package Explorer 在包资源管理器中右键单击您的项目
  2. Click on "Properties". 点击“属性”。
  3. Click on the "Android" tab 点击“ Android”标签
  4. Check the appropriate "Google API" 检查相应的“ Google API”
  5. Apply changes and see if it works. 应用更改,看看是否可行。

You need to create a simulator that has the google libraries in it. 您需要创建一个包含Google库的模拟器。 You can't add it to your app. 您无法将其添加到您的应用中。 If you look, when you created the virtual device you can either pick versions that have or don;t have Google APIs in them. 如果您看的话,在创建虚拟设备时,您可以选择其中包含或不包含Google API的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM