10-03 12:20:48.578: W/dalvikvm(1643): Unable to resolve superclass of Lcom/formation/gmaps/MainActivity; (976)
10-03 12:20:48.578: W/dalvikvm(1643): Link of class 'Lcom/formation/gmaps/MainActivity;' failed
10-03 12:20:48.597: D/AndroidRuntime(1643): Shutting down VM
10-03 12:20:48.597: W/dalvikvm(1643): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-03 12:20:48.627: E/AndroidRuntime(1643): FATAL EXCEPTION: main
10-03 12:20:48.627: E/AndroidRuntime(1643): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.formation.gmaps/com.formation.gmaps.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.formation.gmaps.MainActivity" on path: /data/app/com.formation.gmaps-1.apk
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.os.Looper.loop(Looper.java:137)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-03 12:20:48.627: E/AndroidRuntime(1643): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 12:20:48.627: E/AndroidRuntime(1643): at java.lang.reflect.Method.invoke(Method.java:511)
10-03 12:20:48.627: E/AndroidRuntime(1643): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-03 12:20:48.627: E/AndroidRuntime(1643): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-03 12:20:48.627: E/AndroidRuntime(1643): at dalvik.system.NativeStart.main(Native Method)
10-03 12:20:48.627: E/AndroidRuntime(1643): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.formation.gmaps.MainActivity" on path: /data/app/com.formation.gmaps-1.apk
10-03 12:20:48.627: E/AndroidRuntime(1643): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
10-03 12:20:48.627: E/AndroidRuntime(1643): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-03 12:20:48.627: E/AndroidRuntime(1643): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
10-03 12:20:48.627: E/AndroidRuntime(1643): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
10-03 12:20:48.627: E/AndroidRuntime(1643): ... 11 more
谢谢!
答案 0 :(得分:1)
检查您的日志,请说明,
Didn't find class "com.formation.gmaps.MainActivity" on path: /data/app/com.formation.gmaps-1.apk
因此,请检查您的包com.formation.gmaps,它是否包含 此MainaActivity并检查您的清单以确认
答案 1 :(得分:0)
在您的设备中尝试而不是模拟器,有时它可以与设备一起使用。
答案 2 :(得分:0)
就像日志所说,链接MainActivity时出错,因此那里的一些代码可能很有用
答案 3 :(得分:0)
非常感谢你的答案! 是!我的包com.formation.gmaps包含这个MainActivity,这是我的androidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.formation.gmaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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>
</manifest>
我的主要活动:
package com.formation.gmaps;
import android.os.Bundle;
import android.os.Environment;
import java.io.File;
import org.mapsforge.android.maps.MapActivity;
import org.mapsforge.android.maps.MapView;
@SuppressWarnings("unused")
public class MainActivity extends MapActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mapView = new MapView(this);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mapView.setMapFile(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/map.map");
setContentView(mapView);
}
}
我应该得到一个新的包裹吗?