Black screen during 2 secondes at launch application

426 views
Skip to first unread message

Julian

unread,
Nov 12, 2017, 7:36:02 AM11/12/17
to MIT App Inventor Forum
Hi,

I have finish an application that i create since 1 month, i have install the apk on my phone and when i launch the application i have a black screen during 2 seconde whit the title on the top.
I don't know why i have this, so i have found this topic who talk this problem : https://groups.google.com/forum/#!msg/mitappinventortest/M98RajcM6EY/kAKISprtAwAJ;context-place=searchin/mitappinventortest/black$20screen$20appinventor$202%7Csort:date

I have try to optimize all my image but the problem is still here.

On the topic it's say :

Another trick is to load assets only after Screen initialize is finished, for example by using a clock that waits half a second or so before it fires and then you can do what needs to be done. Disable it also ofter it fires once!

But i don't know how i can make this.
Can you help me.

Thanks
Best regard

Boban Stojmenovic

unread,
Nov 12, 2017, 3:02:59 PM11/12/17
to MIT App Inventor Forum
Unfortunately, It's common behavior with apps made with App Inventor.

I do not know if this even works as it will probably also produce a black screen..

On the topic it's say :

Another trick is to load assets only after Screen initialize is finished, for example by using a clock that waits half a second or so before it fires and then you can do what needs to be done. Disable it also ofter it fires once!

There is a possibility to add a image as backrund or so to remove the black screen but it requires the use of third parties software to achieve this.

Here you can see the MIT companion app with and without manipulation https://photos.app.goo.gl/LXDHA3lA4Wh8J05B3

Boban

Julian

unread,
Nov 13, 2017, 11:41:09 AM11/13/17
to MIT App Inventor Forum
Hi,

Thanks for help.

When you say :
it requires the use of third parties software to achieve this

Have you any name of third parties software that i can test to remove the black screen ?

Best regard

Boban Stojmenovic

unread,
Nov 13, 2017, 7:07:05 PM11/13/17
to MIT App Inventor Forum
There are a couple that I've used and there are many more available online.


AppToMarket outdated, but it can still be used with some exceptions.

ApkModder requires membership in the forum as well as donation to be used.

Apktool is the one I usually use because it is constantly updated.


Note: Both AppToMarket and ApkModder use Apktool to achieve the final result but they have a user-friendly GUI Apktool has not.

Boban

Boban Stojmenovic

unread,
Nov 13, 2017, 7:15:20 PM11/13/17
to mitappinv...@googlegroups.com
For training purposes only if you make this work with AppToMarket, then I can upload the necessary files and description for black screen removal.

New version AppToMarket 4.1

Other tutorials that you can take a look at on my page http://baasapps.com/ for training purposes.

Questions related to AppToMarket or Apkmodder are answered only in the respective forums..

Boban

Julian

unread,
Nov 15, 2017, 4:42:29 PM11/15/17
to MIT App Inventor Forum
Hi,

Thanks for you help and your link.
I will test this and i hope if it's work

Best regard

Chris Ward

unread,
Nov 16, 2017, 6:15:38 PM11/16/17
to MIT App Inventor Forum
Hello Boban

I have used AppToMarket 4.1 to produce a new APK, setting the debug value to True in the manifest (works fine producing a final, signed APK too but I'm still refining the app).

I'm very keen to learn how to remove the black screen!

Boban Stojmenovic

unread,
Nov 17, 2017, 8:11:14 AM11/17/17
to MIT App Inventor Forum
Hi Julian & Chris,

I will try to do a tutorial later in the evening or as late this weekend, as there has been a lot of requests about this lately..

Will post a link to it when it is ready.

Boban

Chris Ward

unread,
Nov 17, 2017, 9:31:43 AM11/17/17
to MIT App Inventor Forum
That's very kind of you Boban, thanks!

Julian

unread,
Nov 17, 2017, 4:15:17 PM11/17/17
to MIT App Inventor Forum
Thanks Boban ;)

Boban Stojmenovic

unread,
Nov 18, 2017, 6:39:22 PM11/18/17
to MIT App Inventor Forum

Chris Ward

unread,
Nov 18, 2017, 7:45:51 PM11/18/17
to MIT App Inventor Forum
Well, that works "straight out of the box" Boban, very good step-by-step instructions!

Thank you very much indeed - I'm sure a lot of AI2 Users will need this.

Chris

Chris Ward

unread,
Nov 19, 2017, 4:42:47 PM11/19/17
to MIT App Inventor Forum
One thing to be aware of is that AppToMarket v4.1 does not retain the edited manifest. It also deletes the additional files baastheme.xml and colors.xml, so it is necessary to keep a copy of these files out of ATM's path.

Also, changing Min SDK Ver/Target SDK Ver does not seem to result in a change of the manifest?

However the manifest includes:

platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727"

.... doesn't that relate to Android Lollipop? If so, not great because I understand that a large number of phones in use are on KitKat or lower.

Boban Stojmenovic

unread,
Nov 20, 2017, 7:17:08 AM11/20/17
to MIT App Inventor Forum
One thing to be aware of is that AppToMarket v4.1 does not retain the edited manifest. It also deletes the additional files baastheme.xml and colors.xml, so it is necessary to keep a copy of these files out of ATM's path.

Yes, each time you decompile the same or new app, the files gets overwritten.

Also, changing Min SDK Ver/Target SDK Ver does not seem to result in a change of the manifest?

usually I use the highest Min SDK 14 and nothing for Target SDK as it's not recommend, otherwise you will lose some features with apps made with MIT..

However the manifest includes:
platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727"
.... doesn't that relate to Android Lollipop? If so, not great because I understand that a large number of phones in use are on KitKat or lower.

It's MIT's build platform, so just ignore it..

Boban

Chris Ward

unread,
Nov 20, 2017, 10:51:56 AM11/20/17
to mitappinv...@googlegroups.com
I see, thanks for that advice Boban - it really is an Android jungle :)

Concerning the Splash Screen, how can a short text be added above the icon image?

Edit: Sorry, another question - how to set the background color? I have tried to change it from white to orange:

..\temp_myDecompiles\res\drawable\baas_splash.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@color/orange"/>
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/ya"/>
    </item>
</layer-list>
 
..\temp_myDecompiles\res\values\colors.xml
 
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="orange">#FFFFC800</color>
</resources>
 
 

Boban Stojmenovic

unread,
Nov 20, 2017, 4:35:26 PM11/20/17
to MIT App Inventor Forum
Try with lowercase letters..

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffff</color>
<color name="orange">#ffffc800</color>
</resources>

#ffffc800 or #ffc800 

Chris Ward

unread,
Nov 20, 2017, 6:50:49 PM11/20/17
to MIT App Inventor Forum
...you beat me to it :)

Chris Ward

unread,
Nov 20, 2017, 8:30:36 PM11/20/17
to mitappinv...@googlegroups.com
Well, tried to be clever by adding text as an image:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:drawable="@color/orange"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/in"/>
    </item>

</layer-list>


....where "@drawable/in" is a 144x144 image text in.png, leaving ya.png as the App Icon. Unfortunately App2Market has eyes in the back of it's head and throws an error :)

So, next attempt, replace the image with text:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">


   
<item
       
android:drawable="@color/orange"/>

   
<item>


            android:gravity="center"
            android:text="Initialising..."

   
</item>


</layer-list>


...gets compiled by App2Market, but fails to install on the device.

Chris Ward

unread,
Nov 21, 2017, 9:43:33 AM11/21/17
to MIT App Inventor Forum
Actually my remark is incorrect, the app is recompiled and it does install on the device, but it does not run - a pop-up message says it has unfortunately closed :)



Chris Ward

unread,
Nov 22, 2017, 3:23:16 PM11/22/17
to MIT App Inventor Forum
I returned to the idea of using a text image on the Splash Screen ("Loading" Screen is the proper name apparently). Failed before, works really well now! So, after editing the Manifest:

..\temp_myDecompiles\AndroidManifest.xml
<application android:debuggable="true" android:icon="@drawable/ya"  android:theme="@style/Theme.BaasTheme"  android:label="My App" android:name="com.google.appinventor.components.runtime.multidex.MultiDexApplication">


..\temp_myDecompiles\res\drawable\baas_splash.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:drawable="@color/orange"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/in"/>
    </item>

</layer-list>


..\temp_myDecompiles\res\drawable\:



..\temp_myDecompiles\res\values\colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="orange">#ffc800</color>
</resources>



I think it's important to note that no other files should be in the folders, as shown here. Also note that AppToMarket v4.1 was used.

Thanks again for your most excellent help Boban. I hope it works for Julian's app too. 

Boban Stojmenovic

unread,
Nov 23, 2017, 6:25:36 AM11/23/17
to MIT App Inventor Forum
Great that you solved this for yourself.

Boban

Harry Mangurian

unread,
Nov 23, 2017, 8:33:29 AM11/23/17
to MIT App Inventor Forum
I am unclear on what causes the problem in the first case.
Is it a bug in AI2 ?

Chris Ward

unread,
Nov 23, 2017, 10:14:49 AM11/23/17
to MIT App Inventor Forum
I can't take any credit there Boban, you did all the tricky stuff and presented it in an easy to follow way.

Chris Ward

unread,
Nov 23, 2017, 10:29:33 AM11/23/17
to MIT App Inventor Forum
Hi Harry

As I understand it, Android is the main culprit as most Apps greater than tiny take a few seconds to load. Keep in mind that most Android smart phones in use are not the super-fast flagship models, which probably can load apps faster via the brute force of the CPU.

There should be ways to reduce the load time of apps, starting with multithreading, making use of all CPU cores available. That is something the MIT guys can work on (perhaps they are?). 

In addition, having a loading screen instead of just a blank, black screen let's the User know that the App is doing something and has not crashed. This where Boban's Android XML files make a huge difference. AI2 certainly should have a proper, customisable loading screen (perhaps the MIT guys are working on that too).

 
Reply all
Reply to author
Forward
0 new messages