jrh
jrh

Reputation: 35

Unable to instantiate activity demo application google play example

Hi i am a newbie and can't overcome the following error: On runtime my android app failed.

The only thing i do is running a google sample in eclipse below

Manifest

<?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>

StackTrace:

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

Upvotes: 0

Views: 222

Answers (1)

Kent Andersen
Kent Andersen

Reputation: 2201

The log basically says it can't find you activity "JrhMainActivity". Have you confirmed that it actually exists? Also, depending on your package structure, you may need to change the "name" field in the manifest to have a fully qualified path.

Upvotes: 1

Related Questions