Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Android App crashes when inactive due to wrong function call in AlarmPingSender
Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1705899] Wed, 19 August 2015 22:04 Go to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
Hey there,

So I have the MqttService running and everything goes smoothly. I can connect, publish and subscribe without any problems. When if I stay inactive for a few minutes, the app crashes.

I know where the problem is. Its in the AlarmPingSender.java file. In the onReceive function there is a function call which goes like this:

MqttToken token = AlarmPingSender.this.comms.checkForActivity(pingCallback);

where comms is a ClientComms object. Now, in the ClientComms class there is a function checkForActivity() which does not take any arguments.

So how do I fix this?

I have downloaded the source and when I export it as a jar using Eclipse it does not work in my app. I get resolution errors for android.supportv4. I've added the required libraries for android.supportv4 but it still doesn't work.

Any help would be really appreciated. Thanks!
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1705971 is a reply to message #1705899] Thu, 20 August 2015 14:07 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Hi,
This sounds like a Bug that we've fixed just recently, however the fix is not yet in the master branch, only in develop.

To get around this, you can change the location of the maven repository for the Android service from "https://repo.eclipse.org/content/repositories/paho-releases/" to "https://repo.eclipse.org/content/repositories/paho-snapshots/"

And then rename the Android service dependency to "org.eclipse.paho.android.service:1.0.3-SNAPSHOT".

That should do the trick, alternatively you can always download the latest snapshot jar directly from here: https://repo.eclipse.org/content/repositories/paho-snapshots/org/eclipse/paho/org.eclipse.paho.android.service/1.0.3-SNAPSHOT/

I'm currently doing a bit of an overhaul on the Android project, so there will be a few changes going through soon that will hopefully make it a lot easier to develop and build locally.
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1705999 is a reply to message #1705971] Thu, 20 August 2015 21:16 Go to previous messageGo to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
Hi,

Thanks for your reply. I'm currently using this: org.eclipse.paho.android.service-1.0.3-20150820.040738-150.jar and it still has the same problem.

Thanks!
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1706163 is a reply to message #1705999] Mon, 24 August 2015 10:09 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Hi,

Hmm, I've tested with that Jar in my application, is there any chance you could get the logs showing the run up to and the error from the Android Logs please?

Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1706312 is a reply to message #1706163] Tue, 25 August 2015 15:08 Go to previous messageGo to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
Hi,

Here's the logcat:

08-25 10:03:47.680 2067-2067/tutorial.clearblade.com.clearbladetutorial I/MqttService﹕ Client Connected
08-25 10:03:47.715 931-931/? W/SurfaceFlinger﹕ couldn't log to binary event log: overflow.
08-25 10:03:49.221 1232-1279/system_process W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
08-25 10:03:56.072 1232-1279/system_process W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
08-25 10:03:56.136 2067-2067/tutorial.clearblade.com.clearbladetutorial I/MqttService﹕ Topic: weather/ Message: hi
08-25 10:04:00.116 1232-1279/system_process W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
08-25 10:04:00.144 2067-2067/tutorial.clearblade.com.clearbladetutorial I/MqttService﹕ Topic: weather/ Message: no
08-25 10:04:47.696 2067-2067/tutorial.clearblade.com.clearbladetutorial D/AlarmPingSender﹕ Ping 1 times.
08-25 10:04:47.696 2067-2067/tutorial.clearblade.com.clearbladetutorial D/AlarmPingSender﹕ Check time :1440515087696
08-25 10:04:47.696 2067-2067/tutorial.clearblade.com.clearbladetutorial D/AndroidRuntime﹕ Shutting down VM
--------- beginning of crash
08-25 10:04:47.705 2067-2067/tutorial.clearblade.com.clearbladetutorial E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: tutorial.clearblade.com.clearbladetutorial, PID: 2067
java.lang.NoSuchMethodError: No virtual method checkForActivity(Lorg/eclipse/paho/client/mqttv3/IMqttActionListener;)Lorg/eclipse/paho/client/mqttv3/MqttToken; in class Lorg/eclipse/paho/client/mqttv3/internal/ClientComms; or its super classes (declaration of 'org.eclipse.paho.client.mqttv3.internal.ClientComms' appears in /data/app/tutorial.clearblade.com.clearbladetutorial-2/base.apk)
at org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver.onReceive(AlarmPingSender.java:157)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
08-25 10:04:47.707 1232-1995/system_process W/ActivityManager﹕ Force finishing activity 1 tutorial.clearblade.com.clearbladetutorial/.PubSubActivity

Thanks
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1706319 is a reply to message #1706312] Tue, 25 August 2015 16:14 Go to previous messageGo to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
You just have to change this:

MqttToken token = AlarmPingSender.this.comms.checkForActivity(pingCallback);

to this:

MqttToken token = AlarmPingSender.this.comms.checkForActivity();

in AlarmPingSender.java

Thanks
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1706522 is a reply to message #1706319] Thu, 27 August 2015 13:34 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
This change has been made in the develop stream, however we don't have the build fully migrated yet so there won't be a SNAPSHOT jar available just yet.
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1707836 is a reply to message #1706522] Wed, 09 September 2015 15:26 Go to previous messageGo to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
Hi,

Thanks a lot! Did you guys release a snapshot for it yet?

Thanks
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1708144 is a reply to message #1707836] Mon, 14 September 2015 08:44 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Hi,

We've not updated the Snapshot build to work with the new gradle project structure yet. Hoping to get that done today.
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1708354 is a reply to message #1708144] Tue, 15 September 2015 19:47 Go to previous messageGo to next message
Sanket Deshpande is currently offline Sanket DeshpandeFriend
Messages: 9
Registered: August 2015
Junior Member
So I downloaded the latest snapshot and now it cannot find the MqttAndroidClient class.
I have downloaded the latest snapshot JAR. And I extracted the jar and found another JAR.

So there is a JAR in the snapshot JAR.
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1708389 is a reply to message #1708354] Wed, 16 September 2015 07:53 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Thanks for spotting that! Working on it now.
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1708404 is a reply to message #1708389] Wed, 16 September 2015 10:22 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Updated SNAPSHOT is now up!
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1722459 is a reply to message #1708404] Fri, 05 February 2016 03:19 Go to previous messageGo to next message
Jacob Perry is currently offline Jacob PerryFriend
Messages: 1
Registered: February 2016
Junior Member
Hello there,

I have run into the exact same kind of crash, would it be possible to check if this is resolved in the SNAPSHOT from 02-04-2016?

After about a minute I receive this Exception:

02-04 22:17:34.259: E/AndroidRuntime(23551): FATAL EXCEPTION: main
02-04 22:17:34.259: E/AndroidRuntime(23551): Process: com.jakeus.homer, PID: 23551
02-04 22:17:34.259: E/AndroidRuntime(23551): java.lang.NoSuchMethodError: No virtual method checkForActivity(Lorg/eclipse/paho/client/mqttv3/IMqttActionListener;)Lorg/eclipse/paho/client/mqttv3/MqttToken; in class Lorg/eclipse/paho/client/mqttv3/internal/ClientComms; or its super classes (declaration of 'org.eclipse.paho.client.mqttv3.internal.ClientComms' appears in /data/app/com.jakeus.homer-2/base.apk)
02-04 22:17:34.259: E/AndroidRuntime(23551): at org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver.onReceive(AlarmPingSender.java:144)
02-04 22:17:34.259: E/AndroidRuntime(23551): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:972)
02-04 22:17:34.259: E/AndroidRuntime(23551): at android.os.Handler.handleCallback(Handler.java:739)
02-04 22:17:34.259: E/AndroidRuntime(23551): at android.os.Handler.dispatchMessage(Handler.java:95)
02-04 22:17:34.259: E/AndroidRuntime(23551): at android.os.Looper.loop(Looper.java:145)
02-04 22:17:34.259: E/AndroidRuntime(23551): at android.app.ActivityThread.main(ActivityThread.java:6895)
02-04 22:17:34.259: E/AndroidRuntime(23551): at java.lang.reflect.Method.invoke(Native Method)
02-04 22:17:34.259: E/AndroidRuntime(23551): at java.lang.reflect.Method.invoke(Method.java:372)
02-04 22:17:34.259: E/AndroidRuntime(23551): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
02-04 22:17:34.259: E/AndroidRuntime(23551): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

Many thanks,
Jacob
Re: Android App crashes when inactive due to wrong function call in AlarmPingSender [message #1724202 is a reply to message #1722459] Mon, 22 February 2016 09:49 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Hi Jacob,

If you use the SNAPSHOT version of the Android service, you need to make sure that you are also using the SNAPSHOT Java library was well. Is this the case?
Previous Topic:can you support max_packets of loop(timeout=1.0, max_packets=1)?
Next Topic:Detecting timeout between device and server
Goto Forum:
  


Current Time: Tue Apr 23 08:56:24 GMT 2024

Powered by FUDForum. Page generated in 0.04362 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top