简体   繁体   English

Java无法解析导入com.google

[英]Java The import com.google cannot be resolved

I am working on building and running an android application in Eclipse. 我正在Eclipse中构建和运行Android应用程序。 I have successfully installed the Android kit, along with the google api via the ADT. 我已经通过ADT成功安装了Android套件以及google api。 I downloaded a sample google map android application to run. 我下载了一个示例谷歌地图android应用程序来运行。 very simple file. 非常简单的文件。 However, my lib references don't seem to be working fine. 但是,我的lib引用似乎没有正常工作。 Even though in the manifest file, the google map api is referenced, my application is not able to resolve the reference 即使在清单文件中引用了谷歌地图api,我的应用程序也无法解析引用

any idea what I need to do next to get the referencing issues resolved please? 知道我需要做什么才能解决引用问题吗?

You have to download google apis for a particular api level through android sdk manager. 你必须通过android sdk manager下载特定api级别的google apis。

在此输入图像描述

Select that google api as project build target. 选择google api作为项目构建目标。

在此输入图像描述

In Eclipse you should be able to configure the project's classpath to point to the libraries in question. 在Eclipse中,您应该能够配置项目的类路径以指向相关的库。 Assuming you have them and the plugin. 假设你有他们和插件。 See the SDK Manager if you don't have them. 如果您没有SDK Manager,请参阅SDK Manager。

Right click on your projects ---> properties ---> android --> select target name Google ApIs. 右键单击你的项目--->属性---> android - >选择目标名称Google ApIs。 And Clean projects and Build the projects. 并清理项目和构建项目。

And also refer this link 并且还请参考链接

If selecting the particular APIs is not working try the following: 如果选择特定API不起作用,请尝试以下操作:

  • project->clean 项目 - >清洁
  • right click on project->Android Tools-> Fix Project Properties 右键单击项目 - > Android工具 - >修复项目属性

Make sure that you have added 确保您已添加

<uses-library android:name="com.google.android.maps" />

line into the AndroidManifest.xml as a child of <application> tag 作为<application>标记的子项进入AndroidManifest.xml

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

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