Skip to first unread message

Pedro González

unread,
May 21, 2017, 1:09:42 PM5/21/17
to MIT App Inventor Forum
Good afternoon,

I have just finished an app and installed it in my android device, but when it opens, a message appears saying "the application has stopped". Does anyone knows what the problem is? I have to submit my project for school next Thursday and I have been developing the application for about a month, but I can't figure out a solution for my issue. I would be grateful if someones provides it to me.

Thanks a lot!

Nico Marikucza

unread,
May 21, 2017, 1:10:48 PM5/21/17
to MIT App Inventor Forum
Please show us your blocks.
Nico

Taifun

unread,
May 21, 2017, 1:11:32 PM5/21/17
to mitappinv...@googlegroups.com
see the following general tips and in your case especially #1 and #2

  1. Use different screens wisely
    Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd

    If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
    The recommended method of switching screens in App Inventor

  2. App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

  3. Avoid redundancy
    Probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/book2 to get an idea how to do DRY programming with App Inventor - Don't repeat yourself 

  4. See SteveJG's monster list of tips and tricks

  5. How to overcome the App Inventor project limit of 10 MB

  6. Backup your project frequently

to find out more about the Runtime Error, you can use Logcat

I normally use Eclipse and Logcat there, but if you have installed the App Inventor Software (see also http://appinventor.mit.edu/explore/ai2/setup-emulator.html), you already have everything you need to use logcat...

How to use Logcat
  1. connect your device using USB with your computer
  2. in File Manager go to the App Inventor directory, which is  C:\Program Files\App Inventor or similar
  3. press Shift and right mouse click the subdirectory commands-for-Appinventor to get the context menu
  4. select "open command window here" and you will get a command window of that subdirectory
  5. enter adb logcat *:E and the logcat will start running and log all errors
  6. start your app to elicit the error
  7. copy the log (see below)
To copy your log, right click, click "select all" and enter to copy the complete log into the clipboard, then open Notepad and paste it using ctrl-v.

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 


Pedro González

unread,
May 22, 2017, 7:00:29 AM5/22/17
to MIT App Inventor Forum
Apparently, there isn't any error so, why the app stops when swithching between Screen1 and Screen2? 
1.PNG
2.PNG

SteveJG

unread,
May 22, 2017, 9:52:12 AM5/22/17
to MIT App Inventor Forum

Yes, switching between screens probably is an issue but not the only issue.  When you switch from Screen2 to Screen1, you should CLOSE Screen2. Unfortunately png #2 is illegible.so we do not see 
how you return to Screen1 or even know how many screens you have or what you are loading on you screens.

Could you provide several images that are legible of your blocks so we can see what you are attempting?  You do not need all your blocks, since you have many blocks which seem to have similar information.
If you have lots of mp3 files and your aia file is over 10 Mb, your device might not have sufficient available memory.  A clue that you may be loading excessive resources or a very large image on your Screen1 is your comment when it opens, a message appears saying "the application has stopped"    If so, temporarily delete the image and try again.

Is png all you have on Screen1?   Is png2 all the blocks you have on Screen2?  


Pedro González

unread,
May 22, 2017, 12:46:17 PM5/22/17
to MIT App Inventor Forum
The following images are the blocks of my Screen2. Those shown in 02.png and 03.png are repeated 7 and 16 times, so as to emulate the function of a launchpad (a kind of musical instrument with 64 buttons that allows you to play different previously programmed songs). The song I have programmed is "Harder, Better, Faster, Stronger" by Daft Punk, having taken the idea from the already existing application "iDaft", only available on the App Store. To do so, I put 16 sound different sound effects, which source is changed when each of the 7 pages (Page_1, Page_2, etc.) are clicked. As a result, when a button of the virtual launchpad is clicked, a sound is reproduced and at the same time the background colour of the button changes into a random colour. I think the problem with my app is related to the amount of sounds I have uploaded: a total of 101, and I know the issue is located on Screen2, and not in the first one, as I succeeded in viewing Screen1 on my smartphone but at the screen switch, as I already said, the app suddenly stops and closes. I hope my description to be helpful to you. Thanks a lot for your support.
01.PNG
02.PNG
03.PNG

Pedro González

unread,
May 22, 2017, 12:47:45 PM5/22/17
to MIT App Inventor Forum
I forgot to say that the .aia file is under 4 MB, so the problem is not related to exceeding the 10 MB limit.

Taifun

unread,
May 22, 2017, 12:56:04 PM5/22/17
to MIT App Inventor Forum
which size (width x height) do you use for the images?

App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

Taifun

Pedro González

unread,
May 23, 2017, 2:40:18 AM5/23/17
to MIT App Inventor Forum
I only have one image in the Screen1, 330*350 px, 25kB, so I think the issue is not related to it but with something in the Screen2.

SteveJG

unread,
May 23, 2017, 8:07:20 AM5/23/17
to mitappinv...@googlegroups.com
You have lots of mp3 files and some wav files on your Screen2. Note that wave files are only supported on Android devices 4.1 and higher (https://developer.android.com/guide/topics/media/media-formats.html) .  If your device is NOT 4.1 or higher, some of your Page_x button code might not work if it sets a *.wav and could crash your app in an unsupported device.

You suspect the issue is on Screen2.   I suggest you make a COPY of your Project    Projects>Save project as...    and experiment by deleting blocks and then trying to install and run.

I would start by disabling all your  png3 blocks to eliminate them as an issue.  You can start by eliminating or disabling the set_workit.BackgroundColor block used after workit.Click.   You can also try reversing the order of the two blocks... try changing background before the workit.Click.

If that does not work, start reducing the number of set xxxx.source blocks.   Are you really using 16 Players?    Using 16 Players is a probable issue.AI may not be able to support that many Player components.  I don't know. That means run a test case with fewer Players.  Another possible issue is changing Source for 16 Players in the click of a button.  This I understand is pre-loading the players...developers using AI might not be able to do that safely depending on the length/size of the sound files.   You might try loading the 'smaller' sound file sources first and the largest perhaps in the 16th position.

Do you ever switch from Screen2 back to Screen1?   If you do that and do not properly release memory by cosing Screen2 that would probably cause a crash.

You might start experimenting because we do not have your code and only you can fix the problem.




Pedro González

unread,
May 23, 2017, 5:51:38 PM5/23/17
to MIT App Inventor Forum
Thank you very much for your advice, Steve. I' m taking it into account.

Pedro González

unread,
May 24, 2017, 6:11:07 PM5/24/17
to MIT App Inventor Forum
Finally I have found the solution to my problem. It seems like player volume is limited to value 100, so if this value is exceeded, the app automatically stops. So idiot and simple, but that was the issue. Thank you all for your help guys!

Abraham Getzler

unread,
May 30, 2017, 4:06:24 PM5/30/17
to MIT App Inventor Forum
Reply all
Reply to author
Forward
0 new messages