App works via AI Companion, and APK installs OK but crash upon open

450 views
Skip to first unread message

Manjot Chana

unread,
Jan 17, 2018, 9:46:27 AM1/17/18
to mitappinv...@googlegroups.com
Hi all!

I have an issue which I am seriously struggling to debug. (First app and first post here btw)

The app I'm trying to develop is a simple soundboard to get me used to the App Inventor. The app had 8 images, 1 sound file, 3 buttons, 3 tables and 3 blocks of code initially and it worked perfectly fine via the Wifi companion app. When I exported the app to an .apk file, the app installed ok on my phone (Samsung Galaxy S7 Edge running Android 7.0) but when I clicked the app icon to run it, a white screen is displayed as if the app is going to launch but then an error appears saying says "Soundboard keeps stopping" and the only option is to "Close App" (screenshot and .apk attached). I am not sure why this is happening?
 
I removed all of the media files, buttons and tables (except 1) as Gooling indicated that they can cause issues due to sizing etc, but the issue is still present. I have attached the .aia file of my current form of the app which only has a single text label on the screen in designer and no blocks of code but the issue is still present.

I have taken a logcat file of me running the app and capturing the failure (attached).  I can see the line:
01-17 14:22:44.648  2990  2990 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference 
which seems like it is the point of failure, but I cannot understand what this means (I am self taught in Python but don't know any Java) nor do I know what I can try to fix it...

Please can someone help me with this? I am really struggling to understand the error and am keen to continue learning. If you need any more information please let me know 

Thanks

apk file was removed.  Posting apk files in this Forum is prohibited as a security issue.    You are welcome to post block images and aia files.
Soundboard_Base.aia
adb logcat file.txt
Screenshot (17 Jan 2018 14_27_28).png

Peregrine Developers

unread,
Jan 17, 2018, 9:59:45 AM1/17/18
to MIT App Inventor Forum
I don't know what the problem is but ill try to figure it out with the aia.

Markus

unread,
Jan 17, 2018, 10:01:25 AM1/17/18
to MIT App Inventor Forum
I have the same problem. The app worked fine, I made some minor changes yesterday, no error messages, worked still fine before compiling. After compiling, the App stops immediately after starting it. even undoing the changes did not help. the old version, which is still on my phone, works fine when i install it again. I run the App on a Samsung Galaxy S8

Peregrine Developers

unread,
Jan 17, 2018, 10:07:17 AM1/17/18
to MIT App Inventor Forum
I don't know what the problem is... could you make another project and just copy your work over and see if it works?

Manjot Chana

unread,
Jan 17, 2018, 10:14:10 AM1/17/18
to MIT App Inventor Forum
Hello,

Thanks for taking a look. I had actually tried to recreate the project with a single button which did nothing (no code for the button in the project), but I still had the same issue. 

Peregrine Developers

unread,
Jan 17, 2018, 10:16:03 AM1/17/18
to MIT App Inventor Forum
Have you added any images or anything else to it?

Manjot Chana

unread,
Jan 17, 2018, 10:18:08 AM1/17/18
to MIT App Inventor Forum
No, no images were added to the new project

Peregrine Developers

unread,
Jan 17, 2018, 10:35:11 AM1/17/18
to MIT App Inventor Forum
I have no idea what the problem is, could you make a project with a short name and don't add anything, no code or components and don't change the properties, just create it and post the aia here?

Manjot Chana

unread,
Jan 17, 2018, 10:37:22 AM1/17/18
to MIT App Inventor Forum
Of course - please find a new blank project .aia called Test attached
Test.aia

Chris Ward

unread,
Jan 17, 2018, 10:51:08 AM1/17/18
to mitappinv...@googlegroups.com
Manjot

The original file you attached, Soundboard_Base.aia, is almost empty. EDIT: The snag is, the app is too minimal, there is nothing to run.

The Title of the APP is unusual ".MainApp". That probably is not a problem but in most programming languages "." has a meaning - if you don't need it, don't do it.

Peregrine Developers

unread,
Jan 17, 2018, 10:52:24 AM1/17/18
to MIT App Inventor Forum
Thank you, I was worried that your account may have been the problem for some reason. I tried that aia and it didn't crash so, could you tell me what you did with the app that did crash before it became what is in the aia you posted?(added removed components images files etc.)

Peregrine Developers

unread,
Jan 17, 2018, 10:54:44 AM1/17/18
to MIT App Inventor Forum
I tried removing that in the aia, unless it corrupted it, that cant be the problem. I changed some of the properties several times and it still crashed.

Chris Ward

unread,
Jan 17, 2018, 10:55:10 AM1/17/18
to MIT App Inventor Forum
Markus

Your issue seems to be a different one to Manjot's.

I think yours is caused by the new Themes issues introduced by App Inventor version nb165 - and soon to be updated with a fix.

For now, in Properties for Screen1, set the Theme to "Classic" and ensure that "Action Bar" is not selected. That should mimic what you had before nb165.

Peregrine Developers

unread,
Jan 17, 2018, 10:55:52 AM1/17/18
to mitappinv...@googlegroups.com
Markus, have you made a topic for this? If not you should. Then people will be able to help. edit: oops I posted this without noticing Chris's post.

Chris Ward

unread,
Jan 17, 2018, 11:01:55 AM1/17/18
to MIT App Inventor Forum
So Manjot, I think we need your original .aia file. We can compile it and try it on our devices and report back :)
Message has been deleted

Peregrine Developers

unread,
Jan 17, 2018, 11:12:41 AM1/17/18
to MIT App Inventor Forum
Did you try the one in the first post? I tried it and it crashed.

Markus

unread,
Jan 17, 2018, 11:15:35 AM1/17/18
to MIT App Inventor Forum
Worked! Thanks a lot!

Chris Ward

unread,
Jan 17, 2018, 11:18:33 AM1/17/18
to MIT App Inventor Forum
Hi Peregrine, not enough there to try :)  Crash or no crash, I don't think it indicates what is wrong with the original project file.

Manjot Chana

unread,
Jan 17, 2018, 11:24:41 AM1/17/18
to MIT App Inventor Forum
Hi Chris,

Please find attached the original .aia which still produces the same error upon launch after APK install on my phone. Also thanks for the advice regarding the Title of the app. I had changed it after some Googling and read somewhere that it might help (it did not, and I forgot to revert the change). 
QuackSoundboard.aia

Chris Ward

unread,
Jan 17, 2018, 12:45:18 PM1/17/18
to MIT App Inventor Forum
Ok Manjot

So, turns out that your issue is with the Themes. I get the same no-go as you with the Project as-is, which has the Theme set to "Device Default". On Android, an Action Bar is expected in that case, but you have not selected one.

So, two choices and you are up and running:

1) Keep Theme "Device Default" and select "Action Bar";
2) Change the Theme to "Classic" and do not select "Action Bar" (recommended, as Themes could change again in the next AI release) 

Manjot Chana

unread,
Jan 17, 2018, 1:29:04 PM1/17/18
to MIT App Inventor Forum
Chris,

You are a genius! Thank you very very much!! I tried both of your solutions and now the APK installs, launches and functions as expected! :D

Ras AndroidData

unread,
Jan 18, 2018, 5:54:40 AM1/18/18
to MIT App Inventor Forum
Best answer..Solved my Project problem too....

Abraham Getzler

unread,
Jan 18, 2018, 9:57:45 AM1/18/18
to MIT App Inventor Forum

Abraham Getzler

unread,
Jan 22, 2018, 1:53:27 PM1/22/18
to MIT App Inventor Forum
If you would like to test the upcoming fix for this, please see
ABG

Reply all
Reply to author
Forward
0 new messages