gpt4 book ai didi

android - 无法实例化 Activity ComponentInfo java.lang.ClassNotFoundException : util. kalyan.HelloGoogleMapsActivity

转载 作者:太空狗 更新时间:2023-10-29 14:29:41 25 4
gpt4 key购买 nike

我已经正确地包含了所有必要的字段。但是,我仍然无法在我的模拟器上启动 Google map 。还检查了互联网权限。出现如下错误:

E/AndroidRuntime(2064): java.lang.RuntimeException: Unable to instantiate activity 
ComponentInfo{util.kalyan/util.kalyan.HelloGoogleMapsActivity}:
java.lang.ClassNotFoundException: util.kalyan.HelloGoogleMapsActivity

请在下面找到我的代码。

HelloGoogleMapsActivity.java

package util.kalyan;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import util.kalyan.R;
public class HelloGoogleMapsActivity extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed()
{
return false;
}
}

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="util.kalyan"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="14" />
<uses-library android:name="com.google.android.maps"></uses-library>
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" >
<activity android:name=".HelloGoogleMapsActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses- permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

任何人请尽早帮助我。提前致谢。

最佳答案

更改 Activity 定义中的 android:name

来自

<activity android:name=".HelloGoogleMapsActivity" ../>

<activity android:name="util.kalyan.HelloGoogleMapsActivity" ../>

关于android - 无法实例化 Activity ComponentInfo java.lang.ClassNotFoundException : util. kalyan.HelloGoogleMapsActivity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8287440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com