0

我正在上课

公共类 GameActivity 扩展 Activity 实现 GLSurfaceView.Renderer, OnTouchListener{

代码没有任何问题,所有需要的方法都实现了。当我启动 Activity 时,它会崩溃并显示以下消息:

java.lang.RuntimeException:无法实例化活动 ComponentInfo{[left out].GameActivity}:java.lang.ClassNotFoundException:在路径 [...] 上找不到类“...GameActivity”

我想在我的游戏中集成 Google 游戏服务和成就。因此,我添加了 libary 项目和GameBaseUtilsas 项目,并检查它们是否应该导出到我生成的 apk 文件中。它编译,用于 google play 服务的 .jar 也被上传并会被找到。所有包括工作。但是当我开始游戏时,它立即崩溃并显示上述错误消息。

我按照developers.android.com https://developers.google.com/games/services/android/init上的教程进行操作

有人可以告诉我我做错了什么吗?这是我的清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=""
android:versionCode="1"
android:versionName="1.0" >

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

<!-- 
  Tell the market, that the the app requires at least OpenGLES 2.0 
  This is not really the truth but it will decrease the rate of error
 -->
<uses-feature android:glEsVersion="0x00020000" 
    android:required="true" />

<!-- Maybe not neccessary -->
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/> -->


<application 
    android:allowBackup="true"
    android:icon="@drawable/launcher_icon"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:screenOrientation="sensorLandscape" >

    <meta-data android:name="com.google.android.gms.games.APP_ID"
    android:value="13465798" />


    <activity
        android:name="GameActivity"
        android:screenOrientation="sensorLandscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!-- For the implementation of Adds in this App -->
</application>

</manifest>

编辑:定位输出

07-21 01:13:47.730: W/dalvikvm(22578): 无法解析 LGameActivity 的超类;(1182) 07-21 01:13:47.730: W/dalvikvm(22578): 类 'L/GameActivity;' 的链接 失败 07-21 01:13:47.730: D/AndroidRuntime(22578): 关闭 VM 07-21 01:13:47.730: W/dalvikvm(22578): threadid=1: 线程退出未捕获异常 (group=0x4159f930) 07-21 01:13:47.746: E/AndroidRuntime(22578): 致命异常: main 07-21 01:13:47.746: E/AndroidRuntime(22578): java.lang.RuntimeException: 无法实例化活动 ComponentInfo{GameActivity} :java.lang.ClassNotFoundException:在路径上找不到类“GameActivity”:.apk 07-21 01:13:47.746: E/AndroidRuntime(22578): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106 ) 07-21 01:13:47.746: E/AndroidRuntime(22578):

4

1 回答 1

1

我发现了错误:

我必须将我用于应用程序的两个项目(GameBaseUtils 和 google-play-services_lib)标记为库项目,并将它们添加到我想要使用的 android 库中。其余的由 android 自己处理。

于 2013-07-21T08:15:19.877 回答