无法实例化活动演示应用程序谷歌播放示例

时间:2013-09-04 18:38:02

标签: java android

您好我是新手,无法克服以下错误: 在运行时我的Android应用程序失败。

我唯一能做的就是在eclipse下面运行google示例

清单

<?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright (C) 2013 Google Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<!-- TO TRY THIS SAMPLE: change the package name below ("package" attribute of
     the <manifest> tag to your own package name. It must not start with
     com.example, com.google or com.android.

     Also, make sure to correct the references to the R object. You can do that
     by adding "import your.package.name.R" to each source file that references
     the R object (where, naturally, "your.package.name" stands for your actual
     package name).
-->


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

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:debuggable="true" >

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

        <activity
            android:name="JrhMainActivity"
            android:label="@string/title_activity_main"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

堆栈跟踪:

09-04 20:28:05.686: W/dalvikvm(26234): Unable to resolve superclass of Ljrh/google/example/games/tc/JrhMainActivity; (740)
09-04 20:28:05.686: W/dalvikvm(26234): Link of class 'Ljrh/google/example/games/tc/JrhMainActivity;' failed
09-04 20:28:05.686: D/AndroidRuntime(26234): Shutting down VM
09-04 20:28:05.686: W/dalvikvm(26234): threadid=1: thread exiting with uncaught exception (group=0x41541700)
09-04 20:28:05.686: E/AndroidRuntime(26234): FATAL EXCEPTION: main
09-04 20:28:05.686: E/AndroidRuntime(26234): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{jrh.google.example.games.tc/jrh.google.example.games.tc.JrhMainActivity}: java.lang.ClassNotFoundException: Didn't find class "jrh.google.example.games.tc.JrhMainActivity" on path: DexPathList[[zip file "/data/app/jrh.google.example.games.tc-1.apk"],nativeLibraryDirectories=[/data/app-lib/jrh.google.example.games.tc-1, /vendor/lib, /system/lib]]
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.os.Looper.loop(Looper.java:137)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread.main(ActivityThread.java:5103)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at java.lang.reflect.Method.invokeNative(Native Method)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at java.lang.reflect.Method.invoke(Method.java:525)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at dalvik.system.NativeStart.main(Native Method)
09-04 20:28:05.686: E/AndroidRuntime(26234): Caused by: java.lang.ClassNotFoundException: Didn't find class "jrh.google.example.games.tc.JrhMainActivity" on path: DexPathList[[zip file "/data/app/jrh.google.example.games.tc-1.apk"],nativeLibraryDirectories=[/data/app-lib/jrh.google.example.games.tc-1, /vendor/lib, /system/lib]]
09-04 20:28:05.686: E/AndroidRuntime(26234):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-04 20:28:05.686: E/AndroidRuntime(26234):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
09-04 20:28:05.686: E/AndroidRuntime(26234):    ... 11 more

1 个答案:

答案 0 :(得分:1)

日志基本上说它找不到你的活动“JrhMainActivity”。你确认它确实存在吗?此外,根据您的包结构,您可能需要更改清单中的“名称”字段以获得完全限定的路径。