当我正在测试我的应用程序的调试版本时 - 没关系。在我签署Google Play版本后,它会启动到FC,但以下情况除外:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.wiagames.guitartuner/com.wiagames.guitartuner.activities.MainActivity}: java.lang.ClassNotFoundException: com.wiagames.guitartuner.activities.MainActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.wiagames.guitartuner.activities.MainActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
清单:
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
<activity android:name=".activities.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
如何解决?
答案 0 :(得分:3)
您可以发布您的应用程序清单文件吗?
我怀疑活动的宣告是不正确的。
它应该类似于以下内容:
<activity android:name="com.wiagames.guitartuner.activities.MainActivity" />
或者,如果你已经有一个包装声明,那么它应该像:
<activity android:name=".activities.MainActivity" />
请注意,您需要在名称值中使用前导句点(即“。”)。
答案 1 :(得分:2)
如果您收到ClassNotFoundException,则必须编写位于Activity
的包activity android:name="com.wiagames.guitartuner.activities.MainActivity"
您的Android Manifest.xml应如下所示:
<activity android:name="com.wiagames.guitartuner.activities.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>