本文介绍了进口com.google.android.gms不能得到解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的Andr​​oid开发。按照本教程我得到了错误进口玉米.google.android.gms解决不了时,我写了code到 MainActivity.java

 进口com.google.android.gms.maps.CameraUpdateFactory;
进口com.google.android.gms.maps.GoogleMap;
进口com.google.android.gms.maps.MapFragment;
进口com.google.android.gms.maps.model.BitmapDesc​​riptorFactory;
进口com.google.android.gms.maps.model.LatLng;
进口com.google.android.gms.maps.model.Marker;
进口com.google.android.gms.maps.model.MarkerOptions;
 

通过搜索各种修复我做了一定要试试这些了:

  • 我已经下载了谷歌的API,通过特定的API级别Android的SDK管理器。
  • 在我检查过谷歌的API作为项目建设的目标。
  • 我已经加入<使用库机器人:名称=com.google.android.maps/> 行成的Andr​​oidManifest.xml 作为一个子<应用> 标记
  • 在我选择清洗项目项目 - >清洁... 和建造它从头开始。
  • 我列入的.jar 文件地图右键单击我的项目,去到构建路径,并添加外部归档并将其放在我的SDK: Android的SDK-WINDOWS \插件\ addon_google_apis_google_inc_8 \库\图

不幸的是,没有以上的帮助。

解决方案

这是无关紧要的,因为这是对地图V1,和你要使用地图V2。

这是错上加错。

首先,永远手工修改构建路径在Android项目。如果你正在做的,充其量,你会崩溃,在运行时,因为你觉得这个JAR在项目中投入(通过手动构建路径的变化)是不是在你的APK。对于一个普通的第三方JAR,把它放在你的项目的库/ 目录,该目录将其添加到您的构建路径自动的的补充其内容到你的APK文件。

不过,地图V2是不是JAR。这是一个Android库项目包含JAR。您需要整个库项目。

您需要导入 Android的SDK-WINDOWS \插件\ addon_google_apis_google_inc_8 项目到Eclipse中,然后将其添加到您的应用程序as引用一个Android库项目。

I am new to Android development. By following this tutorial I got errors The import com.google.android.gms cannot be resolved when I wrote the code into the MainActivity.java:

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

By searching for various fixes I made sure to try these out:

  • I have downloaded Google API's for a particular API level throughAndroid SDK manager.
  • I checked off Google API as project build target.
  • I have added <uses-library android:name="com.google.android.maps" />line into the AndroidManifest.xml as a child of <application> tag.
  • I cleaned the project by selecting Project->Clean... and built itfrom scratch.
  • I included .jar file for maps by right-clicking on my project, wentto build path and added external archive locating it in my SDK: android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps

Unfortunately, none of the above have helped.

解决方案

That is irrelevant, as that is for Maps V1, and you are trying to use Maps V2.

This is doubly wrong.

First, never manually modify the build path in an Android project. If you are doing that, at best, you will crash at runtime, because the JAR you think you put in your project (via the manual build path change) is not in your APK. For an ordinary third-party JAR, put it in the libs/ directory of your project, which will add it to your build path automatically and add its contents to your APK file.

However, Maps V2 is not a JAR. It is an Android library project that contains a JAR. You need the whole library project.

You need to import the android-sdk-windows\add-ons\addon_google_apis_google_inc_8 project into Eclipse, then add it to your app as a reference to an Android library project.

这篇关于进口com.google.android.gms不能得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:52