从活动改变扩展BaseGameActivity后的ClassNotFoundException [英] ClassNotFoundException after changing extension from Activity to BaseGameActivity

查看:250
本文介绍了从活动改变扩展BaseGameActivity后的ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图整合谷歌Android播放服务从的 Android的文档。我把所有的工作步骤,并没有错误编译。在我的闪屏上运行时,我得到下面的错误。

  05-30 21:08:36.115:E / AndroidRuntime(7137):致命异常:螺纹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):在matt.lyons.bibletrivia.lite.SplashScreen $ IntentLauncher.run(SplashScreen.java:46)

下面是code为SplashScreen.java:46。

 意向意图=新意图(SplashScreen.this,MainMenu.class); // 46号线
startActivity(意向);

我只是改变了开行我的的MainMenu 此:

 公共类MainMenu的延伸活动{

这样:

 公共类MainMenu的扩展BaseGameActivity {

而现在我收到的ClassNotFoundException。为什么这个错误弹出?在的MainMenu 类肯定是存在的。可根据要求提供更多code。

Android清单

 <清单
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=matt.lyons.bibletrivia.lite
    安卓版code =5
    机器人:=的versionName1.2.1>    <用途-SDK
        安卓的minSdkVersion =8
        机器人:targetSdkVersion =15/>    <应用
        机器人:图标=@绘制/ icon_blue_bg
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@风格/ AppTheme>
        <活动
            机器人:名字=闪屏
            机器人:screenOrientation =肖像>
            &所述;意图滤光器>
                <作用
                    机器人:名字=android.intent.action.MAIN/>
                <类别
                    机器人:名字=android.intent.category.LAUNCHER/>
            &所述; /意图滤光器>
        < /活性GT;
        <活动
            机器人:名字=com.google.ads.AdActivity
            android:configChanges=\"keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize\" />
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:关于NAME =
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:分类NAME =
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=问题
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=测验
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=。QuestionView
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:结果NAME =
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:榜NAME =
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=。DatabaseHelper
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=ComingSoon
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=的MainMenu
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:为MyApplicationNAME =
            机器人:screenOrientation =肖像/>
        <活动
            机器人:标签=@字符串/ APP_NAME
            机器人:名字=。BibleStudy
            机器人:screenOrientation =肖像/>
    < /用途>    <使用许可权
        机器人:名字=android.permission.INTERNET对/>
    <使用许可权
        机器人:名字=android.permission.ACCESS_NETWORK_STATE/>
    <使用许可权
        机器人:名字=com.android.vending.BILLING/>
< /清单>


解决方案

有同样的问题。

在回答这个问题解决了我。
<一href=\"http://stackoverflow.com/questions/16585964/class-not-found-error-after-updating-adt-and-android-sdk-tools-to-latest-ver-22\">Class未找到错误更新ADT和Android SDK工具到最新版本22 后

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>

解决方案

Had the same issue.

The answer to this question solved it for me. Class not found error after updating ADT and Android sdk tools to latest ver 22

这篇关于从活动改变扩展BaseGameActivity后的ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆