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

how-to-implement-push-notifications-for-android : class not found MQTTConnection

Dieses Thema im Forum "Android App Entwicklung" wurde erstellt von RED-BARON, 12.04.2012.

  1. RED-BARON, 12.04.2012 #1
    RED-BARON

    RED-BARON Threadstarter Android-Hilfe.de Mitglied

    Beiträge:
    146
    Erhaltene Danke:
    19
    Registriert seit:
    06.10.2009
    Hallo Fans :D

    nach diesem Tutorial:
    How to Implement Push Notifications for Android

    habe ich mir das Demo-Projekt:
    https://github.com/tokudu/AndroidPushNotificationsDemo.git

    besorgt und wollte es mit dem Emulator ausprobieren.

    Beim starten im Emulator erhalte ich beim "connect" folgende Exception:
    Could not find class'com.tokudu.demo.PushService$MQTTConnection'

    Kompiliert wird es fehlerfrei.

    Die Klasse existiert offenbar aber und sollte gefunden werden !
    ..\Tokudu\AndroidPushNotificationsDemo\bin\classes\com\tokudu\demo\PushService$MQTTConnection.class

    Um das Demo-Projekt zu laden muss GIT installiert werden und
    Downloads - msysgit - Git for Windows - Google Project Hosting

    git clone https://github.com/tokudu/AndroidPushNotificationsDemo.git

    ausgeführt werden.

    Vll. ist ja jemand so nett und schaut sich das mit an, wenn Zeit ist :thumbup:

    Besten Dank, RB

    Der komplette LogCat, weil die Warnungen mir nicht ganz geheuer vorkommen^^:
    04-12 11:43:41.441: W/dalvikvm(623): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;' failed
    04-12 11:43:43.422: W/dalvikvm(623): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;' failed
    04-12 11:43:51.862: W/dalvikvm(623): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;' failed
    04-12 11:43:53.631: W/dalvikvm(623): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;' failed
    04-12 11:43:56.291: W/dalvikvm(623): VFY: unable to find class referenced in signature (Lcom/ibm/mqtt/MqttPersistence;)
    04-12 11:43:57.301: W/dalvikvm(623): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;' failed
    04-12 11:43:58.031: E/dalvikvm(623): Could not find class 'com.tokudu.demo.PushService$MQTTConnection', referenced from method com.tokudu.demo.PushService.connect
    04-12 11:43:58.041: W/dalvikvm(623): VFY: unable to resolve new-instance 42 (Lcom/tokudu/demo/PushService$MQTTConnection;) in Lcom/tokudu/demo/PushService;
    04-12 11:43:59.313: W/dalvikvm(623): VFY: unable to resolve exception class 32 (Lcom/ibm/mqtt/MqttException;)
    04-12 11:43:59.313: W/dalvikvm(623): VFY: unable to find exception handler at addr 0x29
    04-12 11:43:59.313: W/dalvikvm(623): VFY: rejected Lcom/tokudu/demo/PushService;.connect ()V
    04-12 11:43:59.313: W/dalvikvm(623): VFY: rejecting opcode 0x0d at 0x0029
    04-12 11:43:59.313: W/dalvikvm(623): VFY: rejected Lcom/tokudu/demo/PushService;.connect ()V
    04-12 11:43:59.313: W/dalvikvm(623): Verifier rejected class Lcom/tokudu/demo/PushService;
    04-12 11:44:04.021: W/dalvikvm(623): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
    04-12 11:44:04.172: E/AndroidRuntime(623): FATAL EXCEPTION: main
    04-12 11:44:04.172: E/AndroidRuntime(623): java.lang.VerifyError: com/tokudu/demo/PushService
    04-12 11:44:04.172: E/AndroidRuntime(623): at com.tokudu.demo.PushActivity$1.onClick(PushActivity.java:32)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.view.View.performClick(View.java:3480)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.view.View$PerformClick.run(View.java:13983)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.os.Handler.handleCallback(Handler.java:605)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.os.Handler.dispatchMessage(Handler.java:92)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.os.Looper.loop(Looper.java:137)
    04-12 11:44:04.172: E/AndroidRuntime(623): at android.app.ActivityThread.main(ActivityThread.java:4340)
    04-12 11:44:04.172: E/AndroidRuntime(623): at java.lang.reflect.Method.invokeNative(Native Method)
    04-12 11:44:04.172: E/AndroidRuntime(623): at java.lang.reflect.Method.invoke(Method.java:511)
    04-12 11:44:04.172: E/AndroidRuntime(623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    04-12 11:44:04.172: E/AndroidRuntime(623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    04-12 11:44:04.172: E/AndroidRuntime(623): at dalvik.system.NativeStart.main(Native Method)


    Mein nächster Versuch in onCreate:


    Intent svc =
    new Intent(this, MessageService.class);
    startService(svc);

    MessageService.java​

    Version 1
    publicclass MessageService extends Service

    Version 2
    publicclass MessageService extends Service implements MqttSimpleCallback


    Der Service in Version 1 läßt sich starten, Klasse ist bekannt.​

    Der Service in Version 2 bringt eine Exception ( die fehlenden Methoden des Interfaces wurden autom. generiert )​


    04-12 14:35:59.288: W/ActivityThread(1710): Application demo is waiting for the debugger on port 8100...
    04-12 14:36:12.438: W/dalvikvm(1710): Link of class 'Ldemo/services/MessageService;' failed
    04-12 14:36:12.447: E/dalvikvm(1710): Could not find class 'demo.services.MessageService', referenced from method demo.activities.tourplan.onCreate
    04-12 14:36:12.447: W/dalvikvm(1710): VFY: unable to resolve const-class 341 (Ldemo/services/MessageService;) in Ldemo/activities/main;
    04-12 14:36:27.317: W/dalvikvm(1710): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
    04-12 14:36:27.617: E/AndroidRuntime(1710): FATAL EXCEPTION: main
    04-12 14:36:27.617: E/AndroidRuntime(1710): java.lang.NoClassDefFoundError: demo.services.MessageService
    04-12 14:36:27.617: E/AndroidRuntime(1710): at demo.activities.main.onCreate(main.java:466)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.Activity.performCreate(Activity.java:4465)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.ActivityThread.access$600(ActivityThread.java:122)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.os.Handler.dispatchMessage(Handler.java:99)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.os.Looper.loop(Looper.java:137)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at android.app.ActivityThread.main(ActivityThread.java:4340)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at java.lang.reflect.Method.invokeNative(Native Method)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at java.lang.reflect.Method.invoke(Method.java:511)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    04-12 14:36:27.617: E/AndroidRuntime(1710): at dalvik.system.NativeStart.main(Native Method)


    Ohne Erfolg habe ich mich auch hier umgesehen:
    http://dalelane.co.uk/blog/?p=1599#code

    Es scheint so, sobald auf irgendwas in dem wmqtt.jar Bezug genommen wird kommt es zu den Fehlern​


    Edit: 2012-04-13

    Hier heißt es zu einem vergleichbaren Problem
    http://stackoverflow.com/questions/6247862/getting-caused-by-java-lang-verifyerror

    "You also need to run your jar file through the "dx" tool that comes with the sdk."

    Was ist das "dx" tool ? Im Android-SDK kann ich zumindest nichts finden.


    Nächster Versuch

    manifest:
    <
    uses-libraryandroid:name="com.ibm.mqtt"/>

    [2012-04-13 11:35:52 - demo] ------------------------------
    [2012-04-13 11:35:52 - demo] Android Launch!
    [2012-04-13 11:35:52 - demo] adb is running normally.
    [2012-04-13 11:35:52 - demo] Performing demo.main activity launch
    [2012-04-13 11:35:54 - demo] Uploading demo.apk onto device 'emulator-5554'
    [2012-04-13 11:35:59 - demo] Installing demo.apk...
    [2012-04-13 11:36:04 - demo] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
    [2012-04-13 11:36:04 - demo] Please check logcat output for more details.

    [2012-04-13 11:36:04 - demo] Launch canceled!


    Vll. ist C2DM eine Alternative ?
    http://www.androidbuch.de/index.php/blog/viewpost/50.html

    :)
     
    Zuletzt bearbeitet: 13.04.2012

Diese Seite empfehlen