Android Studio - official 16.507 (ChromeBook)

Previous topic - Next topic

spacefractal

STEAM ONLY

Enable Beta in the steam:
- Right Click on Glbasic in library.
- Click on Properties.
- Click on betas.
- Select "beta - beta builds".

Im still use beta for the version im do, even after a official release when Gernot release that as official (im only release beta versions). This so its possibe to eventuelly do a roolback when testing is required before a release.

First a bit of warning:
This is for the steam version of glbasic. Im cannot garentee its works on Glbasic 15 or below, so im only checked with code from Glbasic 16. Im do no longer uses external downloads.

Here is what that is fixed (listed here as official 16.507 release):
- The theme has been changed a bit, so its now launch in a pure black screen.
- Various new arguments added to androidmanifest.xml, strings.xml and some changes to other xml files (themes).
- Surface might not allways have whole screen! That could causes game not been placed in center correctly. This is fixed.
- navigationbar enabled by default! See next post about it.
- Admob has been more integrated! Admob is optional, not required!
- JOY() commands works much better in this version! Multiply gamepads is even supported!
- You can now use Tilt and Orientation using JOY() commands as well a Android TV remote.
- Assest loading should works much better since SETCURRENTDIR() now finally works correctly between c++ and java. That means c++ does no longer needs to try to guess the path anymore. This is include both relative as well full path using GETCURRENTDIR$()
- Keyboard, Touchpad (one finger) and Mouse (include right button) is now supported for ChromeBook!
- Keyboard can been mapped for pc style scankey layout for most keys. disabled by default. Set it in Strings.xml
- ChromeBook can been detected by PLATFORMINFO$("DEVICE") as well AndroidTV. "Keyboard" tag here is depreacted as im allways hated it and diddent make sense at all!
- Fullscreen is required on ChromeBook! So keep android:resizeableActivity="false" in manifest!

Property other small fixes as well!

Android 6 required!
Android 6 and better is required. Its look like its a grandle issue that cause its dont support png and jpg files in Android 5. Im cant do anything with it at all. So Dont ask me about it. But if you do NOT use png and jpg files at all, then you should been possible to support Android 5. Its depend of game of course.

Can im update Android Studio
Also you can SAFELY update your Android Studio, that include buildtools. But you should stays on the Grandle version we using, currectly version 3.4.1. So dont update the project its self when Android Studio is asking about it to your glbasic project!
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#1
Navigationbar configuration values added
Navigationbar is enabled by default. On most devices you can hide them by the user them self and for me gave much better experience. But resoulution will change, but you can detect it by cheching GETDEKSTIOSIZE() when the navigationbar is hided or show. If you still want exclusive fullscreen? Just configurere it by this in Strings.xml:

<string name="FullScreenLandscape">1</string>
<string name="FullScreenPortrait">1</string>


Glbasic do no longer auto create icons at all
You must do them from Android Studio. Default SDL icons is copied if not present. There is now comply of new icons required to add round icon support as well Adaptive icons. Its easy to do that in Android Studio really.

Just follow this guide to create the new required icons:
https://developer.android.com/studio/write/image-asset-studio

Android Studio cant find and resovle com.google.android.gms:play-services-ads?
Just update the version to the newest one in app/build.grandle!
currectly the newest version is com.google.android.gms:play-services-ads:19.1.0

How glbasic detect Admob?
Just compile from glbasic. Its checks the grandle file the admob has added or not. Admob is DISABLED by default and is commented out in the grandle file!

Java and the merged c++ file overwrite by default
Those is now autowrite by default. If you dont like that, just create a Android.xcl file in the java folder (android_studio\app\src\main\java\org\libsdl\app)! If that file is present, admob check is also disabled as well.

If you get compiler errors with Javacall in Android Studio?
This is a new issue as Gernot have changed the JavaCall a little bit and now using a NAMESPACE directly. That can cause a conflict if you using the old JavaCall$(). This simply dont work anymore. A qutie little annoying why.  But the change was not mine.

All you need to do is just replace JavaCall$ to call android_JAVACALL directly and import the c++ java function like this:

Code (glbasic) Select

?IFDEF ANDROID
IMPORT "C" const char* android_JAVACALL(const char* string)
?ELSE
FUNCTION android_JAVACALL: callStr$
RETURN
ENDFUNCTION
?ENDIF


Alternative you could just rename the JavaCall$ function to something to else and use that. Example like JavaCall2$ or something like that. That could do that too.

Actuelly a little bit annoying me thinks. But its fixable by now.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#2
16.507+ Beta 1  (uploaded and online BETA):

MOUSEAXIS is mostly been fixed (X, Y might not work) and does not support right click and the whell. The whell values is similar to Windows (hopefully).

Implemetation SoundPool again.
This has finally been implemented directly to the music commands. If you enable using this in strings.xml using androidAudio string. This was actuelly  allready implemented in strings.xml, but was newer used, now its do.

Warning:
But do NEWER use a MUSIC (like STOPMUSIC) or SOUND command in GLB_ON_PAUSE (property as well starting/stopping music from GLB_ON_RESUME.

This is regaardless you uses SDL_Mixer or SoundPool option. Your app can possible to crash, include when showing a ad! The later SoundPool one do automatic stop the music when leaving the app abd play again when enter the Activity again. This is possible as SoundPool system is controlled in Java, not in c++ code and no thread conflict should been happens (Java is much more thread safe than c++ ever would been).

This stability issue can happens on android devices about stop music as well. Not just on chromebooks

Also still issues with minimize on chromebooks, but on destroy hopefully finally fixed thtougt.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#3
Im will edit the above posts for any news and updates that has been uploaded and done. So im will NOT remove any posts or clean up by now. No needs.



Im is looking into the stabity issues. its look like the main pile of crap is SUB GLB_ON_PAUSE and need to remove all code im have used by PauseMode(), because this code is not allways invoked.

Im have also seen if you use a MUSIC or SOUND command in SUB GLB_ON_PAUSE, then the game might hang out and crash.

Also if you perform that take a little bit too long, then the sound and music might not turned off and countinue to play..... and then this is a cacth, if yo so tries to use the STOPMUSIC or such command in the pause command, then.... its can hang out due a SDL_Mixer bug.

Nice. Im might need to force to move to SoundPool for Music rather than SDL_Mixer to fix this issue.

Howover there is no issues with SUB GLB_ON_RESUME really. So you could still pause the app when you return to your game. So im might need to force deprecting SUB GLB_ON_PAUSE, even im dont like to do that, due stability issues. Not sure its fixable at all. looking into that.

Also also have crappy issues with the Chromebook that suddently not want to accept adb request anymore.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi Sf,

For the On_Pause issues surely we can code the Sound / Music stop commands to execute prior to proceeding to GLB_ON_PAUSE - so I don't think that's a major issue, is it ?
Not worth the hassle of changing core-setup anyway? Sound music seems to working fine for me on the main.

Chromebook isn't on my radar, as a target dev platform - maybe it is for others - although a nice-to-have it is only about 1.25% of the desktop market and of that 44% of the model range are below Android 6.0+ and therefore unreachable using GLB.

So I would take market size of the platform into consideration before deciding if the features are really worth it... I take it HTML 5 is still being worked on too? That is an important aspect and an important market.

I would love to see an IAP purchase library for Android added :)


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#5
all those issues was on Android. Chromebook is a android device and act like as such. Only changes is added keyboard (if you have remap function, any keys on that keyboard would works), and mouse support as a Chromebook might not have a touchscreen (like mine) and wanted it to act like a pc mouse. Also Chromebooks (that have Android 6+) run pretty much all Android apps from Google Play (include yours). Rest of the system run EXTRACTLY the same as a Android device does. So its was a naturlilly choose to add them.

The only im could not support is windowered mode (but if im can get that to work, then any orientation on normal Android devices as seen in old Android SDK would work again, etc change from landscape to portrait), but that was not important at all now.

No we cannot use sound music stop (or other that tries to use the same memory) commands prior GLB_ON_PAUSE at all (this might also crash regaardles what im did too). Its a some sort of threading issues here and quite impossible to fix. Android Studio and SDL2 simply just interupt when nativePause() is called, im wasent aware of that before yesterday, and also if im remove that call, then no surface is shown when returning! So Im tried various thing and nothing works. The music area can been a reasons of some of the lock ups as well.

So im will ends up to adding soundpool support with automatic pause/resuming, but still possible to use SDL_MIXER (this is not removed, you can choose)........

Im yet to updated, but will update as a beta for first release as its a quite major change.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#6
yes im have created and deleted threads (all my own) yesterdays because im has been so frustated and wasted 2 days now about it. Howover the stabiliy issues on Chromebook is NOT in goal yet, BUT in the other hand, im tracked the main issue to only been a minimized issue now. Etc we have a null pointer reference issue, which also im have seen such a issue on Google Vital on Google Play.......

im was also talking about that chromebook im have also could hang on closing. That bug seens has been fixed by just force close down java rather than waiting for the thread in OnDestroy(). Nice. Im diddent see any draedfull "Spot Race keeps crashing" popups when closing down and open (not when minimized) since. Not sure its was the best fix, but works.

PS. im is sorry for the clashes im did. Im really sorry for that.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#7
ooh year, im found a another issue, which is in END(). This does quit as its should, but also its does create a Tombstone (a crash) and might sent to Google Vital. This is bad! This happens on any devices its seens.

Howover im do have partically fixed this issue. When im update, then its will quit as normal, but the task manager might still shown the app, but all resource is killed and released the memory and the app will restart. This is far better than a crash on quit.

Here all nedded to let Java kill the app rather than c++ like this:

Code (glbasic) Select

    void END() {
#ifdef ANDROID
        int ok = JavaCall_Str(DGStr("ShutDown")); // let Java kill the process or you get get a crash.
        return;
#endif
        SETLOOPSUB(DGStr(""));
        __Error(CMP_OK);
        __EndProgram();
    }


Also im confirm by just renaming all JavaCall$ to JavaCall2$ (or something other) also can compile and run it again. JavaCall$ is internal used as a function now and hence its wont compile it anymore. But easy to fix that one.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

dreamerman

Quote from: spacefractalbut the task manager might still shown the app, but all resource is killed and released the memory and the app will restart. This is far better than a crash on quit.
I think that many app works that way? They are still shown on task list, but tapping on them just relaunches app, so not a problem it this not raise any big errors.

btw Android target is using older SDL or SDL2?
Check my source code editor for GLBasic - link Update: 20.04.2020

spacefractal

#9
SLD2 is used with Android Studio as well either SDLMixer or SoundPool (selectable by strings.xml) for music. No its not a real problem at all. much better than its creating a tombstone really when END() is used for quit.

Tombstone is the Android name for a crash and those might sendt to Google Vital. hence im want to avoid them. But there is still a mystery null pointer reference issue left. But its is still quite much more stable now.

Just DONT use any graphics or music/sound commands in GLB_ON_PAUSE() as well GLB_ON_RESUME() and GLB_ON_QUIT(). Those might crash and create a tombstone. That even if you uses that before showing a ads (which calls those functions too).

Even Greedy Mouse got catched about that (LIMITFPS in GLB_ON_RESUME() was even a bad idea) and removed those commands now. so a update is soon for both games for testing.

PS. On ChromeBook this seens also works to after the END() fix and completly close the game without have trouble to restart it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

I find this statement very confusing
<!-- Set this number to one, if you want ads loading to take care internally, etc you don't want to use
         ads_loads. Value is set to 1 if this line does NOT present -->

Is it:
1 = use ads
0 = dont use ads?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

It's just if you want to automatic load a ad or you want to do that by your own by ads_load. 1 does automatic while 0 does not.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

#12
Okay thanks.

Also, just tried to build a new android project and the code is failing to compile...some error with android.mk or something...

Was there another GLB Android platform update this week or so?

Nevermind - got it working it was folder with spaces and dash in name that created the error
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs