图形页面中MapActivity未找到类 [英] Mapview in MapActivity Class not found

查看:129
本文介绍了图形页面中MapActivity未找到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过的其他线程这里有类似的症状,但没有答案的解决我的问题。我下面的谷歌地图视图教程, http://developer.android .COM /资源/教程/视图/ HELLO-mapview.html ,并完全遵守所有的方向,我不断收到这个错误..抛出java.lang.ClassNotFoundException:com.goodintechnology.maps.Mymap装载机dalvik.system。 PathClassLoader [/data/app/com.goodintechnology.maps-1.apk]

我从头多次启动,但每次,只要我改活动,以MapActivity,错误被抛出。该应用程序的目标是谷歌API 2.2,和仿真器是一样的,有功能的GPS。我试图把用途库语句前,后,以及在应用程序语句,但这并没有改变任何东西。我甚至试图把语句垂直的清单。因此,经过约8小时搞乱,我把它给大家。这里的code:

 的Andr​​oidManifest.xml
 

 <使用库机器人:名称=com.google.android.maps/>
<使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>

<应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>
    <活动机器人:MYMAPNAME =
              机器人:标签=@字符串/ APP_NAME>
        <意向滤光器>
            <作用机器人:名称=android.intent.action.MAIN/>
            <类机器人:名称=android.intent.category.LAUNCHER/>
        &所述; /意图滤光器>
    < /活性GT;

< /用途>
 

和布局main.xml中          

 < com.google.android.maps.MapView
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID /图形页面
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:可点击=真
    机器人:apiKey =我的钥匙在谷歌中生成的是在这里信任我。
/>
< / LinearLayout中>
 

和类MYMAP

 包com.goodintechnology.maps;
进口com.google.android.maps.MapActivity;
进口android.os.Bundle;

公共类MYMAP扩展MapActivity {
/ **第一次创建活动时调用。 * /
@覆盖
公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.main);
}

@覆盖
保护的布尔isRouteDisplayed(){
    // TODO自动生成方法存根
    返回false;
}
}
 

如前所述,这是所有直接从谷歌地图查看教程。

解决方案

 <使用库机器人:名称=com.google.android.maps/>
 

必须在<应用> < /用途>

你说你试过了,但如何你现在拥有它,它wont't任何机会的工作,因此改变第一。

I've seen other threads here with similar symptoms, but none of the answers solved my problem. I'm following the Google map view tutorial, http://developer.android.com/resources/tutorials/views/hello-mapview.html and following all directions exactly, I keep getting this error .. java.lang.ClassNotFoundException: com.goodintechnology.maps.Mymap in loader dalvik.system.PathClassLoader[/data/app/com.goodintechnology.maps-1.apk]

I've started from scratch many times, but everytime, as soon as I change the Activity to MapActivity, the error is thrown. The app target is Google API 2.2, and the emulator is the same, with GPS enabled. I've tried putting the uses-library statement before, after, and in the Applications statement, but that didn't change anything. I even tried putting the statement vertically in the manifest. So, after about 8 hours messing with this, I put it to all of you. Here's the code:

AndroidManifest.xml

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

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Mymap"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

and the layout main.xml

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="My key that was generated on google is here. trust me"
/>
</LinearLayout>

And the class Mymap

package com.goodintechnology.maps;
import com.google.android.maps.MapActivity;
import android.os.Bundle;

public class Mymap extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}
}

As mentioned this is all straight from Google Map View tutorial.

解决方案

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

must be within <application> </application>

You said you tried that, but how you currently have it, it wont't work by any chance, so change that first.

这篇关于图形页面中MapActivity未找到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆