com.google.android.maps不存在奇怪的错误

时间:2011-11-01 13:57:11

标签: android google-maps

我无法构建我的android项目,它说com.google.android.maps不存在。这很奇怪,因为在我的图书馆项目中,我有它们。我重建了build.xml。导入com.google.android.maps.MapActivity;未标记为错误。我该怎么办?

Handling Resources...
Generating resource IDs...
C:\android-sdk-windows\tools\ant\build.xml:600: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 13 source files to C:\Users\iie\Documents\NetBeansProjects\AndroidApplication3\bin\classes
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:10: error: package com.google.android.maps does not exist
import com.google.android.maps.MapActivity;
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:16: error: cannot find symbol
public class MapMapa extends MapActivity {
  symbol: class MapActivity
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:21: error: cannot find symbol
        super.onCreate(icicle);
  symbol:   variable super
  location: class MapMapa
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:23: error: cannot find symbol
         setContentView(R.layout.map);      
  symbol:   method setContentView(int)
  location: class MapMapa
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:19: error: method does not override or implement a method from a supertype
    @Override
C:\Users\bla\Documents\NetBeansProjects\AndroidApplication3\src\menu\dot\MapMapa.java:26: error: method does not override or implement a method from a supertype
    @Override
6 errors
C:\android-sdk-windows\tools\ant\build.xml:580: The following error occurred while executing this line:
C:\android-sdk-windows\tools\ant\build.xml:600: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

2 个答案:

答案 0 :(得分:4)

确保你

  • 在Android SDK中安装Google API(这意味着“Google API”选择而不是“Android X.x”)

  • 指定在清单XML中使用此库:

    <uses-library android:name="com.google.android.maps" />
    
  • 选择“Google API”作为“构建目标”,“Android X.x”。

仅供参考,在使用模拟器AVD进行测试时,您需要启动“Google API”版本而不是“Android X.x”版本。

答案 1 :(得分:2)

好的,最后我设法解决了这个问题:

这是一个包含所有内容的链接:

http://code.davidjanes.com/blog/2009/11/13/18-hours-of-jar-hell-with-android-google-maps/

抱歉回答我自己的问题