Android Question Unfortunately 'MyApp' has stopped working

Buncher60

Member
Licensed User
When re-starting an application after it was 'minimized', I get an OS message 'Unfortunately theApp has stopped working!.

This only occurs when the device is offline. Online it works without a hitch.

Does anyone have any idea why this would occur?

(For an explanation of 'minimized' see this link: minimize thread #4
 

JohnC

Expert
Licensed User
Please post the contents of the log window (on the right side of the IDE) when this error occurs.
 
Upvote 0

JohnC

Expert
Licensed User
Try connecting your PC to the device using a USB cable so that the log window can display the error.
 
Upvote 0

aeric

Expert
Licensed User
Maybe (a good idea to?) use Try Catch to prevent unhandled exception.
 
Upvote 0

DonManfred

Expert
Licensed User
It's offline in release mode!
and that´s the reason you do not get any log? Connect the device using USB Debugging, check the LOG and post the full error. Without it we only can try to fish...
You also can upload a small project showing the problem
 
Upvote 0

Buncher60

Member
Licensed User
Just a friendly tip - don't assume 'New Member' means 'Newbie Member' posts #2, #5, #6.

I use B4A Bridge because I've found the USB connection method is, at best, intermittent - hence the problem debugging offline!

As it turns out, this problem is caused by a recursive call in offline mode.

It is caused by call a StopService using the 'Me' as the service name under certain circumstances. There are several posts that I've seen that use the 'Me' as the service name which I followed, which turned out to be incorrect.

The correct Object to pass is "" as per the intellisense.

Thank you all who contributed.
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
It is caused by call a StopService using the 'Me' as the service name under certain circumstances. There are several posts that I've seen that use the 'Me' as the service name which I followed, which turned out to be incorrect.

The correct Object to pass is "" as per the intellisense.
Not true. There is no problem with passing Me and it is actually preferred.
 
Upvote 0

Buncher60

Member
Licensed User
Not true. There is no problem with passing Me and it is actually preferred.

It is True according to these:
ServiceStop_Help.png


Can you provide an official link to a document that indicates 'Me' is preferred or an explanation as to why you've decided that 'Me' is preferred.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Just a friendly tip - don't assume 'New Member' means 'Newbie Member' posts #2, #5, #6.

Maybe if you had posted some useful information (like logs) in your OP, others wouldn't have assumed that you're a "Newbie Member" -> https://www.b4x.com/android/forum/threads/for-new-er-members-how-to-post-a-question-issue.96964/

I use B4A Bridge because I've found the USB connection method is, at best, intermittent - hence the problem debugging offline!

I pretty much exclusively use USB debugging on all of my 10 or so test devices - except one that has a dodgy USB port - because I find it much faster when I'm doing a lot of code->build->test iterations. If you're finding USB debugging isn't working for you, then I'd say you've got some configuration, driver, &/or hardware issues.

- Colin.
 
Upvote 0

Buncher60

Member
Licensed User
Maybe if you had posted some useful information (like logs) in your OP, others wouldn't have assumed that you're a "Newbie Member" -> https://www.b4x.com/android/forum/threads/for-new-er-members-how-to-post-a-question-issue.96964/



I pretty much exclusively use USB debugging on all of my 10 or so test devices - except one that has a dodgy USB port - because I find it much faster when I'm doing a lot of code->build->test iterations. If you're finding USB debugging isn't working for you, then I'd say you've got some configuration, driver, &/or hardware issues.

- Colin.

Read my first post.

Why is everyone getting so frothy at the mouth. I didn't ask for any help with programming.

I simply asked if anyone had encountered this particular circumstance of this message when offline.

Now we're getting to the point where all the trolls have come out of hiding.

I've resolved the issue, so a simple no or a 'yes, it happened because of this...' would have sufficed.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Read my first post.

Why is everyone getting so frothy at the mouth. I didn't ask for any help with programming.

I simply asked if anyone had encountered this particular circumstance of this message when offline.
Errr - you were the one who said "Just a friendly tip - don't assume 'New Member' means 'Newbie Member' posts #2, #5, #6. " - so you were clearly "frothy at the mouth" about being assumed a Newbie, even though you posted like one.

I did read your first post & there was nothing in it that was of any use in terms of suggesting what the cause might be. "Unfortunately the app has stopped working" is about as generic a message as you can get. Asking for help without providing any details of logs, code or other useful information is a waste of your time & the time of anybody who gets sucked into reading your post(s).

Then to top it off you clearly took issue with Erel's post & challenged him to prove what he said is correct - not exactly an approach that will encourage other members to help you in the future I'd say.

Now we're getting to the point where all the trolls have come out of hiding.
That's cool - this "troll" is happy to let you struggle through on your own in future.

I've resolved the issue, so a simple no or a 'yes, it happened because of this...' would have sufficed.
Read my first reply & the second paragraph of this one. Just to clarify - YOU DIDN'T PROVIDE ENOUGH INFORMATION FOR ANYONE TO SAY WHY IT HAPPENED. Clear enough for you?

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Also - there are a number of members in these forums (including me) who regularly take time out of their days to look through the various posts & try to offer assistance to others who are having issues. If you look back through my posting history you'll see that I very rarely ask for help, but I have posted a lot of responses to questions - as have many of the other members - in an effort to help resolve issues that other developers are encountering. I even try to answer posts in forums for B4X products that I don't use, but where I might have some parallel experience that is useful.

My point is that doing this takes time - time that I should be using to earn a living developing & releasing apps & time that during which others no doubt have other things they could be doing - so it can sometimes be a little demotivating & frustrating when people post asking for help without providing adequate relevant information & then get bent out of shape when it's suggested that they should try to help themselves by being a little more forthcoming.

Glad you got it sorted in any case.

- Colin.
 
Upvote 0

JohnC

Expert
Licensed User
Just a friendly tip - don't assume 'New Member' means 'Newbie Member' posts #2, #5, #6.

I use B4A Bridge because I've found the USB connection method is, at best, intermittent - hence the problem debugging offline!

Just a friendly reminder to you too...

When all you post is a very broad question that amounted to nothing more then "when I switch away from my app, it crashes" and don't provide any more details. We are going to naturally assume you are a newbie because there are a million things that could crash your app because we have no idea what your app does and why it might crash when it gets pushed to the background. Does it run an animation, does it play a song, does it access the internet, etc.

And when you said "Offline", that typically means you are not accessing the "internet". But there is absolutely no way that we should have known that the USB port on your PC or device is broken and that is why you couldn't use it to debug and post the log window! So, with no logs, this further supported our impression that you were a newbie because a non-newbie would know to post the logs so we can get an idea of what is causing the error.

And your post #10 also supports the impression of you being a newbie, because if you were familiar with the forums, you would know that Erel is the creator of B4x and you would also know he bends over backwards to help ALL the forum members. And if you would have known this, I think you would have been a little more respectful with your post instead of outright contradicting him in a rather rude manner.

So, because you didn't provide much details, you can't blame us for thinking you were a newbie.
 
Last edited:
Upvote 0

Buncher60

Member
Licensed User
Errr - you were the one who said "Just a friendly tip - don't assume 'New Member' means 'Newbie Member' posts #2, #5, #6. " - so you were clearly "frothy at the mouth" about being assumed a Newbie, even though you posted like one.

I did read your first post & there was nothing in it that was of any use in terms of suggesting what the cause might be. "Unfortunately the app has stopped working" is about as generic a message as you can get. Asking for help without providing any details of logs, code or other useful information is a waste of your time & the time of anybody who gets sucked into reading your post(s).

Then to top it off you clearly took issue with Erel's post & challenged him to prove what he said is correct - not exactly an approach that will encourage other members to help you in the future I'd say.


That's cool - this "troll" is happy to let you struggle through on your own in future.


Read my first reply & the second paragraph of this one. Just to clarify - YOU DIDN'T PROVIDE ENOUGH INFORMATION FOR ANYONE TO SAY WHY IT HAPPENED. Clear enough for you?

- Colin.

You must be the sort of person who never challenges anything anyone that you seem to be in awe of, says.

Erel said what I said wasn't true without justifying why. I provided the evidence that he was wrong and challenged him to tell me why I was wrong.

Nothing sinister in that. Simply asking if he had some inside information that I'm not yet privy to. Perhaps he will explain later.

If someone asks for a log when I've already said it was offline what else can I say.

Finally, I wasn't struggling with anything. As I said, I was looking for a 'yes and this happened answer' - not the history of the World.

You can feel privileged that this is the last post on these forums and you were the recipient. It's simply not worth the hassle.

Good luck with your 10 egos!
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
Please, no need to fight.
an you provide an official link to a document that indicates 'Me' is preferred or an explanation as to why you've decided that 'Me' is preferred.
This is a valid question and there is no doubt that the documentation should be updated. I've fixed it for the next update.

In the first versions of B4A the various keywords that accept an activity or module parameter only worked with strings:
B4X:
StartActivity("Activity2")
StartService("Service1")
StopService("AnotherService")
StopService("")
The empty string represented the current module.
This still mostly works. I'm saying mostly, because it will fail in some cases in compiled libraries (not the empty string).

At some point Me was added and now you can write it like this:
B4X:
StartActivity(Activity2)
StartService(Service1)
StopService(AnotherService)
StopService(Me)

This notation will work in all cases, it is checked at compile time, there is autocomplete and it is more clear.
 
Upvote 0
Top