0
我的xperia neo v cell(android v 2.3.4)上運行簡單示例代碼時遇到了大問題。 我已經導入android-support-v4.jar並將google-play-services_lib添加到項目庫。 請給我一些問題什麼可以解決我的問題。 我的問題是這樣的:Android 2.3.4上的Android Maps V2.4薑餅
02-24 23:27:34.183: E/AndroidRuntime(19099): FATAL EXCEPTION: main
02-24 23:27:34.183: E/AndroidRuntime(19099): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.googleMapApp/com.googleMapApp.LocationProfileManagerActivity}: java.lang.ClassNotFoundException: com.googleMapApp.LocationProfileManagerActivity in loader dalvik.system.PathClassLoader[/data/app/com.googleMapApp-1.apk]
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1581)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.os.Handler.dispatchMessage(Handler.java:99)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.os.Looper.loop(Looper.java:130)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread.main(ActivityThread.java:3701)
02-24 23:27:34.183: E/AndroidRuntime(19099): at java.lang.reflect.Method.invokeNative(Native Method)
02-24 23:27:34.183: E/AndroidRuntime(19099): at java.lang.reflect.Method.invoke(Method.java:507)
02-24 23:27:34.183: E/AndroidRuntime(19099): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
02-24 23:27:34.183: E/AndroidRuntime(19099): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
02-24 23:27:34.183: E/AndroidRuntime(19099): at dalvik.system.NativeStart.main(Native Method)
02-24 23:27:34.183: E/AndroidRuntime(19099): Caused by: java.lang.ClassNotFoundException: com.googleMapApp.LocationProfileManagerActivity in loader dalvik.system.PathClassLoader[/data/app/com.googleMapApp-1.apk]
02-24 23:27:34.183: E/AndroidRuntime(19099): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
02-24 23:27:34.183: E/AndroidRuntime(19099): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
02-24 23:27:34.183: E/AndroidRuntime(19099): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-24 23:27:34.183: E/AndroidRuntime(19099): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
02-24 23:27:34.183: E/AndroidRuntime(19099): ... 11 more
我的清單文件:
`<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googleMapApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="com.googleMapApp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.googleMapApp.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Require OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".LocationProfileManagerActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my_key" />
</application>
</manifest>`
我Main.java文件:
package com.example.googlemapapp;
import com.googleMapApp.R;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class Main extends FragmentActivity{
@Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView (R.layout.activity);
}
}
版式文件:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent" />