1. Nimm jetzt an unserem Uhans - 3. ADVENT - Gewinnspiel teil - Alle Informationen findest Du hier!

Hat jemand das "Staumelder" aus dem Arno Becker Buch probiert?

Dieses Thema im Forum "Android App Entwicklung" wurde erstellt von thomas2004ch, 27.10.2010.

  1. thomas2004ch, 27.10.2010 #1
    thomas2004ch

    thomas2004ch Threadstarter Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    0
    Registriert seit:
    27.10.2010
    Hallo zusammen,

    bin ganz neu bei Android und lerne das mit den Beispielen in Arno Becker's Buch.

    In Kapitel 1 gibt's ein Beispiel "Staumelder". Ich habe die Sourcecode untergezogen (Androidbuch | Downloads) und habe das Beispiel "staumelder-intro" in Eclipse importiert und zum laufen gebracht.

    Nach dem Starten sehe ich die Buttons, Drop-down Menu und alles in Emulator. So weit so gut.

    Ich klick das Menu in Emulator und es zeigt auf den Anzeiger "Melden". Das ist auch richtig. Wenn ich aber auf "Melden" klicke, bekomme Fehler wie:
    Code:
    Sorry:
    
    The application Android-Staumelder (process de.androidbuch.staumelder) has stopped unexpectedly. Please try again.
    
    In Console in Eclipse habe ich aber keinen Fehler gesehen. Hier ist was in Console:
    Code:
    [2010-10-27 12:35:39 - staumelder-intro15] ------------------------------
    [2010-10-27 12:35:39 - staumelder-intro15] Android Launch!
    [2010-10-27 12:35:39 - staumelder-intro15] adb is running normally.
    [2010-10-27 12:35:39 - staumelder-intro15] Performing de.androidbuch.staumelder.StaumeldungErfassen activity launch
    [2010-10-27 12:35:39 - staumelder-intro15] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Android-Emulator'
    [2010-10-27 12:35:42 - staumelder-intro15] Application already deployed. No need to reinstall.
    [2010-10-27 12:35:42 - staumelder-intro15] Starting activity de.androidbuch.staumelder.StaumeldungErfassen on device emulator-5554
    [2010-10-27 12:35:43 - staumelder-intro15] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=de.androidbuch.staumelder/.StaumeldungErfassen }
    
    
    Hat jemand Ahnung?
     
    Zuletzt bearbeitet: 27.10.2010
  2. Stefan Baumgartner, 27.10.2010 #2
    Stefan Baumgartner

    Stefan Baumgartner Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    2
    Registriert seit:
    20.10.2010
    in Android werden die Fehler nicht in der Console sondern im LogCat ausgegeben. Wär toll wenn du den auszug auch posten könntest.
     
  3. thomas2004ch, 27.10.2010 #3
    thomas2004ch

    thomas2004ch Threadstarter Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    0
    Registriert seit:
    27.10.2010
    Wo findet man das "LogCat"? Ich habe unter dem Projekt-Verzeichnis gesucht aber nichts gefunden.
     
  4. Stefan Baumgartner, 27.10.2010 #4
    Stefan Baumgartner

    Stefan Baumgartner Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    2
    Registriert seit:
    20.10.2010
    bei eclipse ist unten links so ein kleines Fenster mit einem Plus. Dort draufklicken dann auf Other -> Android -> LogCat
     
  5. thomas2004ch, 27.10.2010 #5
    thomas2004ch

    thomas2004ch Threadstarter Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    0
    Registriert seit:
    27.10.2010

    Das ist aber total versteckt. :)

    Aber hier sind die Logs in LogCat. Kennst Du was aus?

    Code:
    ...
    10-27 12:05:46.166: DEBUG/AndroidRuntime(554): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
    10-27 12:05:46.166: DEBUG/AndroidRuntime(554): CheckJNI is ON
    10-27 12:05:46.437: DEBUG/AndroidRuntime(554): --- registering native functions ---
    10-27 12:05:47.607: DEBUG/dalvikvm(394): GC_EXPLICIT freed 155 objects / 8016 bytes in 90ms
    10-27 12:05:47.667: DEBUG/PackageParser(72): Scanning package: /data/app/vmdl23998.tmp
    10-27 12:05:47.677: INFO/PackageParser(72): de.wei.app: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
    10-27 12:05:47.787: DEBUG/PackageManager(72): Scanning package de.wei.app
    10-27 12:05:47.818: INFO/PackageManager(72): /data/app/de.wei.app-1.apk changed; unpacking
    10-27 12:05:47.837: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/de.wei.app-1.apk' ---
    10-27 12:05:48.117: DEBUG/dalvikvm(561): DexOpt: load 49ms, verify 18ms, opt 3ms
    10-27 12:05:48.136: DEBUG/installd(35): DexInv: --- END '/data/app/de.wei.app-1.apk' (success) ---
    10-27 12:05:48.136: DEBUG/PackageManager(72):   Activities: de.wei.app.MyActivity
    10-27 12:05:48.158: INFO/ActivityManager(72): Force stopping package de.wei.app uid=10033
    10-27 12:05:48.347: INFO/installd(35): move /data/dalvik-cache/data@app@de.wei.app-1.apk@classes.dex -> /data/dalvik-cache/data@app@de.wei.app-1.apk@classes.dex
    10-27 12:05:48.357: DEBUG/PackageManager(72): New package installed in /data/app/de.wei.app-1.apk
    10-27 12:05:49.187: DEBUG/dalvikvm(72): GC_EXPLICIT freed 6110 objects / 388080 bytes in 265ms
    10-27 12:05:49.208: DEBUG/AndroidRuntime(554): Shutting down VM
    10-27 12:05:49.227: DEBUG/dalvikvm(554): Debugger has detached; object registry had 1 entries
    10-27 12:05:49.247: WARN/RecognitionManagerService(72): no available voice recognition services found
    10-27 12:05:49.256: INFO/AndroidRuntime(554): NOTE: attach of thread 'Binder Thread #3' failed
    10-27 12:05:50.266: DEBUG/AndroidRuntime(566): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
    10-27 12:05:50.266: DEBUG/AndroidRuntime(566): CheckJNI is ON
    10-27 12:05:50.577: DEBUG/AndroidRuntime(566): --- registering native functions ---
    10-27 12:05:51.677: INFO/ActivityManager(72): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=de.wei.app/.MyActivity }
    10-27 12:05:51.887: DEBUG/AndroidRuntime(566): Shutting down VM
    10-27 12:05:51.907: DEBUG/dalvikvm(566): Debugger has detached; object registry had 1 entries
    10-27 12:05:51.998: INFO/AndroidRuntime(566): NOTE: attach of thread 'Binder Thread #3' failed
    10-27 12:05:52.117: INFO/ActivityManager(72): Start proc de.wei.app for activity de.wei.app/.MyActivity: pid=573 uid=10033 gids={1015}
    10-27 12:05:53.327: INFO/ActivityManager(72): Displayed activity de.wei.app/.MyActivity: 1462 ms (total 1462 ms)
    10-27 12:05:58.467: DEBUG/dalvikvm(252): GC_EXPLICIT freed 987 objects / 52544 bytes in 102ms
    10-27 12:06:05.127: DEBUG/dalvikvm(394): GC_EXPLICIT freed 85 objects / 3720 bytes in 89ms
    10-27 12:06:10.137: DEBUG/dalvikvm(404): GC_EXPLICIT freed 240 objects / 11472 bytes in 99ms
    10-27 12:06:17.256: DEBUG/dalvikvm(72): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.267: DEBUG/dalvikvm(205): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.267: DEBUG/dalvikvm(209): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.287: DEBUG/dalvikvm(573): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.297: DEBUG/dalvikvm(489): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.297: DEBUG/dalvikvm(252): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.297: DEBUG/dalvikvm(269): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.307: DEBUG/dalvikvm(280): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.307: DEBUG/dalvikvm(301): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.317: DEBUG/dalvikvm(316): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.317: DEBUG/dalvikvm(329): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.326: DEBUG/dalvikvm(359): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.326: DEBUG/dalvikvm(394): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.326: DEBUG/dalvikvm(404): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.336: DEBUG/dalvikvm(429): Debugger has detached; object registry had 1 entries
    10-27 12:06:17.336: DEBUG/dalvikvm(366): Debugger has detached; object registry had 1 entries
    10-27 12:06:31.776: DEBUG/SntpClient(72): request time failed: java.net.SocketException: Address family not supported by protocol
    10-27 12:08:40.618: DEBUG/AndroidRuntime(588): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
    10-27 12:08:40.627: DEBUG/AndroidRuntime(588): CheckJNI is ON
    10-27 12:08:40.938: DEBUG/AndroidRuntime(588): --- registering native functions ---
    10-27 12:08:42.047: DEBUG/dalvikvm(394): GC_EXPLICIT freed 108 objects / 9400 bytes in 91ms
    10-27 12:08:42.108: DEBUG/PackageParser(72): Scanning package: /data/app/vmdl23999.tmp
    10-27 12:08:42.157: WARN/PackageParser(72): Unknown element under <manifest>: activity at /data/app/vmdl23999.tmp Binary XML file line #16
    10-27 12:08:42.157: INFO/PackageParser(72): de.androidbuch.staumelder: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
    10-27 12:08:42.278: INFO/PackageManager(72): Removing non-system package:de.androidbuch.staumelder
    10-27 12:08:42.278: INFO/ActivityManager(72): Force stopping package de.androidbuch.staumelder uid=10032
    10-27 12:08:42.477: DEBUG/PackageManager(72): Scanning package de.androidbuch.staumelder
    10-27 12:08:42.487: INFO/PackageManager(72): Package de.androidbuch.staumelder codePath changed from /data/app/de.androidbuch.staumelder-2.apk to /data/app/de.androidbuch.staumelder-1.apk; Retaining data and using new
    10-27 12:08:42.487: INFO/PackageManager(72): /data/app/de.androidbuch.staumelder-1.apk changed; unpacking
    10-27 12:08:42.506: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/de.androidbuch.staumelder-1.apk' ---
    10-27 12:08:42.757: INFO/ActivityManager(72): Process com.android.mms (pid 329) has died.
    10-27 12:08:42.967: DEBUG/dalvikvm(595): DexOpt: load 99ms, verify 137ms, opt 3ms
    10-27 12:08:42.987: DEBUG/installd(35): DexInv: --- END '/data/app/de.androidbuch.staumelder-1.apk' (success) ---
    10-27 12:08:42.997: WARN/PackageManager(72): Code path for pkg : de.androidbuch.staumelder changing from /data/app/de.androidbuch.staumelder-2.apk to /data/app/de.androidbuch.staumelder-1.apk
    10-27 12:08:42.997: WARN/PackageManager(72): Resource path for pkg : de.androidbuch.staumelder changing from /data/app/de.androidbuch.staumelder-2.apk to /data/app/de.androidbuch.staumelder-1.apk
    10-27 12:08:42.997: DEBUG/PackageManager(72):   Activities: de.androidbuch.staumelder.StaumeldungErfassen
    10-27 12:08:43.006: INFO/ActivityManager(72): Force stopping package de.androidbuch.staumelder uid=10032
    10-27 12:08:43.208: INFO/installd(35): move /data/dalvik-cache/data@app@de.androidbuch.staumelder-1.apk@classes.dex -> /data/dalvik-cache/data@app@de.androidbuch.staumelder-1.apk@classes.dex
    10-27 12:08:43.208: DEBUG/PackageManager(72): New package installed in /data/app/de.androidbuch.staumelder-1.apk
    10-27 12:08:43.436: INFO/ActivityManager(72): Force stopping package de.androidbuch.staumelder uid=10032
    10-27 12:08:43.647: DEBUG/dalvikvm(72): GC_EXPLICIT freed 7999 objects / 530736 bytes in 185ms
    10-27 12:08:44.017: DEBUG/dalvikvm(252): GC_EXPLICIT freed 127 objects / 5664 bytes in 366ms
    10-27 12:08:44.157: WARN/RecognitionManagerService(72): no available voice recognition services found
    10-27 12:08:44.417: DEBUG/dalvikvm(72): GC_EXPLICIT freed 3566 objects / 200064 bytes in 151ms
    10-27 12:08:44.487: DEBUG/dalvikvm(269): GC_EXPLICIT freed 2204 objects / 113376 bytes in 744ms
    10-27 12:08:44.618: INFO/installd(35): unlink /data/dalvik-cache/data@app@de.androidbuch.staumelder-2.apk@classes.dex
    10-27 12:08:44.637: DEBUG/AndroidRuntime(588): Shutting down VM
    10-27 12:08:44.657: DEBUG/dalvikvm(588): Debugger has detached; object registry had 1 entries
    10-27 12:08:44.676: INFO/AndroidRuntime(588): NOTE: attach of thread 'Binder Thread #3' failed
    10-27 12:08:45.448: DEBUG/AndroidRuntime(601): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
    10-27 12:08:45.448: DEBUG/AndroidRuntime(601): CheckJNI is ON
    10-27 12:08:45.747: DEBUG/AndroidRuntime(601): --- registering native functions ---
    10-27 12:08:46.798: INFO/ActivityManager(72): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=de.androidbuch.staumelder/.StaumeldungErfassen }
    10-27 12:08:46.868: INFO/ActivityManager(72): Start proc de.androidbuch.staumelder for activity de.androidbuch.staumelder/.StaumeldungErfassen: pid=607 uid=10032 gids={1015}
    10-27 12:08:46.878: DEBUG/AndroidRuntime(601): Shutting down VM
    10-27 12:08:46.897: DEBUG/dalvikvm(601): Debugger has detached; object registry had 1 entries
    10-27 12:08:46.958: INFO/AndroidRuntime(601): NOTE: attach of thread 'Binder Thread #3' failed
    10-27 12:08:48.027: INFO/ActivityManager(72): Displayed activity de.androidbuch.staumelder/.StaumeldungErfassen: 1185 ms (total 1185 ms)
    10-27 12:08:53.167: DEBUG/dalvikvm(573): GC_EXPLICIT freed 744 objects / 54504 bytes in 89ms
    10-27 12:08:58.187: DEBUG/dalvikvm(394): GC_EXPLICIT freed 177 objects / 12400 bytes in 100ms
    10-27 12:09:06.027: DEBUG/dalvikvm(404): GC_EXPLICIT freed 80 objects / 3680 bytes in 1001ms
    10-27 12:09:06.926: WARN/InputManagerService(72): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43e5b318
    10-27 12:09:07.887: WARN/KeyCharacterMap(607): No keyboard for id 0
    10-27 12:09:07.887: WARN/KeyCharacterMap(607): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
    10-27 12:09:07.906: INFO/System.out(607): I am here
    10-27 12:09:21.466: DEBUG/StaumeldungErfassen(607): Stauursache: Baustelle
    10-27 12:09:21.466: DEBUG/StaumeldungErfassen(607): Position: 2131099650
    10-27 12:09:21.476: INFO/System.out(607): I am here
    10-27 12:09:21.486: INFO/ActivityManager(72): Starting activity: Intent { cmp=de.androidbuch.staumelder/.StauinfoAnzeigen (has extras) }
    10-27 12:09:21.486: DEBUG/AndroidRuntime(607): Shutting down VM
    10-27 12:09:21.506: WARN/dalvikvm(607): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607): FATAL EXCEPTION: main
    10-27 12:09:21.528: ERROR/AndroidRuntime(607): android.content.ActivityNotFoundException: Unable to find explicit activity class {de.androidbuch.staumelder/de.androidbuch.staumelder.StauinfoAnzeigen}; have you declared this activity in your AndroidManifest.xml?
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.Activity.startActivityForResult(Activity.java:2817)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.Activity.startActivity(Activity.java:2923)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at de.androidbuch.staumelder.StaumeldungErfassen.onOptionsItemSelected(StaumeldungErfassen.java:55)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.Activity.onMenuItemSelected(Activity.java:2195)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.view.View$PerformClick.run(View.java:8816)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.os.Handler.handleCallback(Handler.java:587)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.os.Handler.dispatchMessage(Handler.java:92)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.os.Looper.loop(Looper.java:123)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at java.lang.reflect.Method.invokeNative(Native Method)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at java.lang.reflect.Method.invoke(Method.java:521)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    10-27 12:09:21.528: ERROR/AndroidRuntime(607):     at dalvik.system.NativeStart.main(Native Method)
    10-27 12:09:21.556: WARN/ActivityManager(72):   Force finishing activity de.androidbuch.staumelder/.StaumeldungErfassen
    10-27 12:09:22.088: WARN/ActivityManager(72): Activity pause timeout for HistoryRecord{43f6d6d8 de.androidbuch.staumelder/.StaumeldungErfassen}
    10-27 12:09:32.452: WARN/ActivityManager(72): Activity destroy timeout for HistoryRecord{43f6d6d8 de.androidbuch.staumelder/.StaumeldungErfassen}
    ...
    
     
  6. thomas2004ch, 27.10.2010 #6
    thomas2004ch

    thomas2004ch Threadstarter Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    0
    Registriert seit:
    27.10.2010
    Ich sehe schon in Exception:
    Code:
    ...
    10-27 12:09:21.528: ERROR/AndroidRuntime(607): android.content.ActivityNotFoundException: Unable to find explicit activity class {de.androidbuch.staumelder/de.androidbuch.staumelder.StauinfoAnzeigen}; have you declared this activity in your AndroidManifest.xml?
    ...
    
    Hier ist das AndroidManifest.xml. Alles ist da, eigentlich. Warum hat er gemerket?

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="de.androidbuch.staumelder"
          android:versionCode="1"
          android:versionName="1.0">
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".StaumeldungErfassen"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
        </application>
        <activity android:name=".StauinfoAnzeigen" />
        <uses-sdk android:minSdkVersion="3" />
    
    </manifest> 
    
     
    Zuletzt bearbeitet: 27.10.2010
  7. thomas2004ch, 27.10.2010 #7
    thomas2004ch

    thomas2004ch Threadstarter Neuer Benutzer

    Beiträge:
    19
    Erhaltene Danke:
    0
    Registriert seit:
    27.10.2010
    Ich habe den Fehler in Code gefunden. das Manifest muss wie folgend sein:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="de.androidbuch.staumelder"
          android:versionCode="1"
          android:versionName="1.0">
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".StaumeldungErfassen"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
         <activity android:name=".StauinfoAnzeigen" />
    
        </application>
        <uses-sdk android:minSdkVersion="3" />
    
    </manifest>
     

Diese Seite empfehlen