我已经构建了一个使用 android maps API V2 的 android 应用程序,它对我来说很好用。
当我将应用程序提交到 Google Play 时,我遇到了很多例外情况,人们说该应用程序无法正常工作。
系统找不到 MainActivity。
StackTrace 是
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mostafa.cairometrobeta/com.mostafa.cairometrobeta.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.mostafa.cairometrobeta.MainActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/com.mostafa.cairometrobeta-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mostafa.cairometrobeta.MainActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/com.mostafa.cairometrobeta-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
... 11 more
和清单文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mostafa.cairometrobeta"
android:versionCode="7"
android:versionName="1.0.2"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission android:name="com.mostafa.cairometrobeta.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.mostafa.cairometrobeta.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<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>
<activity android:name="GuideActivity"></activity>
<activity android:name="GalleryActivity"></activity>
<activity android:name="NearbyActivity"></activity>
<activity android:name="SettingsActivity"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MapKey" />
</application>
有什么问题 ?!