0

I am trying to integrate Android Google Play Services from the Android docs. I got all the steps working and it compiles with no errors. At runtime on my splash screen, I get the below error.

05-30 21:08:36.115: E/AndroidRuntime(7137): FATAL EXCEPTION: Thread-153
05-30 21:08:36.115: E/AndroidRuntime(7137): java.lang.NoClassDefFoundError: matt.lyons.bibletrivia.lite.MainMenu
05-30 21:08:36.115: E/AndroidRuntime(7137):     at matt.lyons.bibletrivia.lite.SplashScreen$IntentLauncher.run(SplashScreen.java:46)

Below is the code to "SplashScreen.java:46".

Intent intent = new Intent(SplashScreen.this, MainMenu.class);  //Line 46
startActivity(intent);

I just changed the opening line in my MainMenu from this:

public class MainMenu extends Activity {

to this:

public class MainMenu extends BaseGameActivity {

And now I am getting the ClassNotFoundException. Why is this error popping up? The MainMenu class is definitely there. More code can be provided upon request.

Android Manifest

<manifest 
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="matt.lyons.bibletrivia.lite"
    android:versionCode="5"
    android:versionName="1.2.1" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/icon_blue_bg"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".SplashScreen"
            android:screenOrientation="portrait" >
            <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" />
        <activity
            android:label="@string/app_name"
            android:name=".About"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".Categories"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".Question"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".Quiz"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".QuestionView"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".Results"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".Highscores"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".DatabaseHelper"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".ComingSoon"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".MainMenu"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".MyApplication"
            android:screenOrientation="portrait" />
        <activity
            android:label="@string/app_name"
            android:name=".BibleStudy"
            android:screenOrientation="portrait" />
    </application>

    <uses-permission 
        android:name="android.permission.INTERNET" />
    <uses-permission 
        android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission 
        android:name="com.android.vending.BILLING" />
</manifest>
4

3 回答 3

0

有同样的问题。

这个问题的答案为我解决了这个问题。 将 ADT 和 Android sdk 工具更新到最新版本 22 后找不到类错误

于 2013-06-04T19:53:31.233 回答
0

在以下位置创建一个新活动:

File->New->Other->Android Activity->Blanc Activity

然后在Hierarchical Parent选择BaseGameActivity...

之后将 MainActivity 的代码复制到您刚刚创建的活动中......

我相信这样你就不会出错。

于 2013-06-03T14:05:05.680 回答
0

在清单中添加<activity android:name=".MainMenu" />内部标签。application

于 2013-06-03T13:50:33.730 回答