GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2019-Aug-03

Title: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-03
Hi

Just wondering if anyone has tried the android studio update to build 32/64 versions of GLB apps for mobile?

Can't seem to find any docs on it - how to start / steps involved / etc.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-09
Gernot or Spacefractal - just wondering if any steps or general advise on using v16 for Android?
Is it working for 64bit apk building?
Title: Re: Android - has anyone tried yet?
Post by: Kitty Hello on 2019-Aug-10
Yes. The V16 from STEAM creates a fully featured Android project for you and opens Android Studio. You have every single piece of code as C++ in this project (a bit scrambled, but it compiles!).
So, you even could build for MIPS or whatnot exotic platform.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-10
im have been quite away and havent even checked this that much. but yes, the Android Studio compile with full source code and does not use any precompiled so files. So its can compile to any platform its support. But im could not get watches to work as they quite different effort.

But Android TV, 32/64 bit is supported and with Intel/ARM cpus binaries.

Android Studio do should download all eventuelly misses components if required before you can compile it to a emulator for testing.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-11
 :enc:
Excited to try it!!
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-11
Okay - got my debug apk built after a few GB of downloads and installs...

Apk for Simple Turtle did not open.

Could be my AE stuff is breaking it...
do I need to remove AExtras specific code or does that matter?

Is there anything I should look out for - no ads or what not in this app...also Androidmanifest I just added the package details etc.

https://www.dropbox.com/s/hkdw7okwppnofj3/app-debug.apk?dl=0 (https://www.dropbox.com/s/hkdw7okwppnofj3/app-debug.apk?dl=0)
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-12
Also, where is the c++ code placed in the Android Studio project?
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-12
Okay got my AStudio setup running and building...now signing too...
I tried to Run App on Device and in Android Studio - failed.

Unexpected error while executing: am start -n "com.Gazzapper_Games.SimpleTurtle/com.gazzappergames.simpleturtle.logo.educational.SDLGlbasic" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

Any ideas?? Manifest issue?
Here is my manifest

Code: (glbasic) [Select]
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.gazzappergames.simpleturtle.logo.educational"

    android:installLocation="auto" >

    <!-- OpenGL ES 2.0 -->
    <uses-feature android:glEsVersion="0x00020000" />

    <!-- GLBASIC_USER_NOTE app permissions and features -->

    <!-- Touchscreen support -->
    <uses-feature android:name="android.hardware.touchscreen" android:required="true" />

    <!-- Game controller support -->
    <uses-feature android:name="android.hardware.gamepad" android:required="false" />

    <!-- External mouse input events -->
    <uses-feature android:name="android.hardware.type.pc" android:required="false" />

    <!-- Has Android TV support (here you need to support a least the tv removte and has landscape mode -->
    <!-- <uses-feature android:name="android.software.leanback" android:required="false" /> -->

    <!-- If your app support Android Go? -->
    <uses-feature android:name="android.hardware.ram.low" android:required="false" />

    <!-- Allow access to the vibrator, permission is not required -->
    <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->

    <!-- Checkout the battery status (etc you could lower the framerate in low battery or like that, permission is not required -->
    <!-- <uses-permission android:name="android.permission.BATTERY_STATS" />  -->

    <!-- Allow writing to external storage -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Allow access to the internet -->
    <uses-permission android:name="android.permission.INTERNET" />

    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true" />

    <application
        android:isGame="true"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:allowBackup="true"
        android:banner="@mipmap/banner"
        android:hardwareAccelerated="true">

        <activity android:name="SDLGlbasic"
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:label="@string/app_name"
            android:screenOrientation="sensorLandscape"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <!-- <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> -->
            </intent-filter>
        </activity>
    </application>

</manifest>
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-13
Did you checked readme.glbasic.txt? Please checkit out.

do not change the package name at all! leave it to package="org.libsdl.app" <- this is for the executable file, not the app name package! Android Studio cant simply find the exe at all and then fails.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-13
Excellent! Thanks SF!

Sorry what does the package name apply to?
This is usually the package of the playstore unique app name in the manifest. no?
Okay - I will try this then - where does the unique app package name go now so?

Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-13
Another small issue - the build that AStudio creates is 500MB! Quite a size for small apk - is there a way to avoid this?
Title: Re: Android - has anyone tried yet?
Post by: erico on 2019-Aug-13
An apk at that size? There must be something going into it that is not necessary.
I will be trying android out again very soon and let you know.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-13
An apk at that size? There must be something going into it that is not necessary.
I will be trying android out again very soon and let you know.

Not the apk itself (about 6mb) - but all the supporting project folder src and libs files - not sure if that's normal or just down to how I installed my Android Studio.

Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-13
My logcat from trying to run the built & signed apk

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-14
The Package in manifest goes for the package name java and C++ using and when the code communicate between C++ and Java (org.libsdl.app). So if you changes it, Android Studio and Android simply just wont launch it at all!

Also again, checkout the readme file where to find unique id and more. The unique app id is in a grandle file, where you also set the sdk as well.

Android Studio emulators is also supported, but crash when running in Android 4.2 and below. here im wont fix it, they are too old anyway and is now unsupported.

Also this version compiles to 4 binaries (amd 32/64bit and intel 32/64bit).

Im can do nothing about the project size, this is just how Android Studio works and the NDK can been very insane biggie. But as long the apk is its self is small im would not mind. You can also clean up that build again when you are finished using it. This is no wonder throguht its can take some minuttes to build (can take 3-4 minuttes here first time).

Also do not ask me about ads in this version as its has not been implemented yet as im have not looked into that. Howover implementing google ads in this version would not been compatible with the previous version as this version would works a little bit different.

Also if its crash, then Android Studio should point to the code where its crashed, if you using the debug version.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-14
Thanks SF,

I did those package changes - I will try run my app in debug mode now to see if I can get some info on the crash.

My logo app project is quite straightforward and I disabled the AExtras parts but still there is issue.

I wonder if the older java call I'm using is different to the one the new projects use?

Code: (glbasic) [Select]
GLOBAL Android AS AndroidExtras

?IFDEF ANDROID
IMPORT "C" const char* android_JAVACALL(const char* string)
?ENDIF

FUNCTION JavaCall$: callStr$
?IFDEF ANDROID
// IF adService.state=1 THEN RETURN
STATIC res$
res$ = android_JAVACALL(callStr$)
RETURN res$
?ENDIF
ENDFUNCTION
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-14
The previous log did not started its has started the app at all. If it's a Java issue, it's should have been launched anyway when tried to call it from glbasic.

Androidextras stuff was howover not touched or checked and javacalls its self mehod has not changed.

The app name can also been set in strings. Xml
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-14
Debug version Working Now on AS emulator! But not the signed version on my device ...

Does this work on anyones device?

https://www.dropbox.com/s/k70gfknoy8ykxfa/app-release.apk?dl=0


[Update: it works on my nexus tablet but not on my Samsung J3 with android 5.1.1.]

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-14
Need the logcat when connected to pc or the full project (except the big build folder).
Title: Re: Android - has anyone tried yet?
Post by: erico on 2019-Aug-15
Samsung Note 2 with android 4.4.2 installs, when executed, it rotates the screen to black, but after a few seconds, re-rotates back and exits.
Galaxy s5 with android 6.0.1, installs and runs all fine here.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-15
im want to have your project as im might have used some depreacted feature used that must been skipped on older devices. Im do NOT need the glbasic source code, just the Android Studio Project with the project cleaned.

Howover Its looks like on Samsung Note 2 does runs, but fails for some reason. So could this been a copy assests/creating folder issue in the startup?

If its that, try to do something like below start in your code to manually build up the folders:

Code: (glbasic) [Select]
?IFDEF ANDROID
IF DOESDIREXIST("Media")=0 THEN CREATEDIR("Media")
IF DOESDIREXIST("Media/levels")=0 THEN CREATEDIR("Media/levels")
IF DOESDIREXIST("Media/music/ogg")=0 THEN CREATEDIR("Media/music/ogg")
?ENDIF
SETCURRENTDIR("Media") // seperate media and binaries?


This is something im have NOT state in the readme, but should have do that, if its that bug?

PS. Android 4.3 and below os out as least. Im wont support and no idea if its a graphics issues in Android 4.4 throught, but want to see the app first.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-15
Ok - I will try your code first and then if no joy - I will clean and send to you
:)
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-15
I cleaned the project - still 400 mb maybe i did it wrong?

Update: Sorted - got it to 78mb will send a dropbox link.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-15
Sent that to you! Good luck! :)
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-15
Hi SF,

Wasnt the folder thing i think - as my Android.init() was doing that already.

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-17
oddely its works nicely here on a Android 5 and a Android 9 phones when im run it directly from Android Studio while connected. This is only that im have tried. Have you tried that to run it directly from Android Studio?

Howover there is a bug in SETACTIVEMOUSE, which is a easy bug to been fix. See the bug section.

Not sure what it happens in glb_showscreen_init_next_frame as its diddent crash and then not sure which command that do it.

you can do try in around line 20184 in lib_glbasic.cpp (search after for(int i=0; i<5; ++i)) do this (not sure its was that throught, but im do thinks its might call too early on some devices):

Code: (glbasic) [Select]
#if !defined(ANDROID))
        for(int i=0; i<5; ++i) {
        SHOWSCREEN();
}
#endif
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-17
Also make sure to use key(1) for back and eventuelly quit the app. And the popup on start is annoying to dismiss.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-17
Yes ran from Android Studio and From Playstore and both failed to run on my J3 phone.

I am gonna try it on another older phone now too - but glad to hear it works for you.

On the pop up:
That app doesn't require write permission - so wondering if there is a way to fetch how 'old' the app install is?
That way I can remove the popups after few days.


Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-17
It's the app popup I'm talking about in the app its self and not a system popup. Its annoying to dismiss its seen. Which emulator did you tried to use? Im need to reproduce it first what it happens.

PS. The font can been too small too read on a small screen? But the emulators can also screw up sometimes.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-17
I'm checking the follows days what it's happens on the surface on some devices (SHOWSCREEN) . Etc its might try to draw on a destroyed surface, property due orientation or something like that. But is not home before tomorrow.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-18
hmmm the 3 of the crashes you sent to me was in SHOWSCREEN command, but im do more think the main issue can believe in the VIEWPORT command?

Im got a crash with a emulator when im set SetOrientation(-1) too early in the GlobalInit in SOME emulators for some reasons. Here its simply just crash on the line __g_pRbow3D->DoShadows(false); in the VIEWPORT command as its seen.

If im remove that line, the app runs again in that emulator include that wrongly placed orientation command in the init.

Im wonder this could been the issue? This is just a shoot.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
The bit with

Code: (glbasic) [Select]
#if !defined(ANDROID))
        for(int i=0; i<5; ++i) {
        SHOWSCREEN();
}
#endif
 

I could not find around lines 20184 or so but around 18478

Code: (glbasic) [Select]
#if defined(WIN32) && !defined(WANT_SDL_MIXER)
pDXsnd->SetWindow(__g_pRbow->m_WND.hwnd);
#endif
for(int i=0; i<5; ++i) {
SHOWSCREEN();
}
#endif

Is it that you want me to try with the #if !defined(ANDROID) instead?
Is that the change?

Thanks
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
I'm don't think it's the main issue at all. but more when SHOWSCREEN is called while surface is still destroyed, when can been happens on orientation or such.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
Thanks SF - if it helps - I don't use any 3D commands in my games.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
im know. but last time im could see a possible crash on a 3d command if invoked too early. not sure its could happens with 2d too with some systems?
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
I am looking at trying to adding Admob myself (carefully), into the code.
Is the best route to adding  to lib_glbasic.cpp and fire with java call?
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
Also, the Showscreen crash message refers the 64bit version of the app
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
all java calls is not directed to SDLGlbasic rather than the activity java and the admob might works a little bit different as you do NOT need the old lib code at all, because that one is depreacted. So im havent has a look nor im will do in near future.

Stability come simply just first.

Im also just seen the app can call a OnResume() in the startup, which might have confused glbasic as well and eventuelly call a SHOWSCREEN before a surface has been created and then its will crash. That is not good. Im have fixed that.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
I just tried emulator version of an app using key(1) and the back button on the emulator does not fire it correctly?

Am I doing something wrong does key(1) require another change to get it to work on emulator to bind to the "back button"?

pressing esc works on windows version.


Ignore that - back worked just now in emulator. :)
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
Hi SF

Does this app install okay for you - its a release version-works on my emulator but not on my phone device.

https://www.dropbox.com/s/a2yc2z2urd8hb2v/app-breaker.apk?dl=0
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
Not sure how relevant this is ... but this error show in my studio output

  C++ calling SDL_CreateWindow (fs:1)
E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

Emulator still runs but maybe if affects devices differently
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
im know, but currectly no idea why and Android Studio is hightly annoying like hell as IDE simply just hang after that.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19


From the link about user says this

https://stackoverflow.com/questions/33210443/error-validate-display255-error-3008-egl-bad-display-by-toutorial (https://stackoverflow.com/questions/33210443/error-validate-display255-error-3008-egl-bad-display-by-toutorial)

"I had the same issue when I tried to load webview on Dialog. If I load webview on activity, it works well."
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
we dont use any of that. also im have running into major trouble with Android Studio that just hanging, if you forgot to close the app down before closing emulator (which im first found up after about 20 crashes).

So make sure to close the app in the emulator to avoid Android Studio crash. Not sure why its happens throught.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
im gonna think im should add a "GLB_ON_SHOW" function to make sure SHOWSCREEN can been invoked even when copy files or dir. A App can possible crash on loading if the game loading time is more than 5 secs if no SHOWSCREEN is called.

This feature is done and has send to Gernot. Also if GLB_ON_SHOW is not found, then glbasic will just force calling SHOWSCREEN to noticy the system (with a blank screen) on a assets access and under a recursive copying. This often can take too long time to complete and then might crash and force it to been closed down.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-19
there Opengl issue is more like this one:
https://discourse.libsdl.org/t/sdl2-2-0-7-android/23547

But its does run as its seen, that the matter. anyway the Android Crashes was more about connection in the emulator and not the app its self. but just make sure to close it down before launch a new one.

We are howover on SDL version 2.0.9 (required due Google Play requirements).
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-19
API-22 using Pixel 3 emu - fails
API-27 on Pixel is fine

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
im found the reason for that, but still not sure to  fix it. Its fails when loading your sprite and its try to load them in bmp, png, jpg versions. you cant do that. So here we required to check the extension of the file and then load the image directly, then the game will run.

etc its fails on this line in c++:
Code: (glbasic) [Select]
    if (!image.LoadImageBMP(szFileName, colorkey) && !image.LoadImagePNG(szFileName, colorkey) &&
        !image.LoadImageJPG(szFileName)) {
        g_debug("Image can't be loaded: %s\n", szFileName);
        return false;
    }

if im remove the BMP and JPG lines and only load them in PNG, then the game launch and works.

Code: (glbasic) [Select]
    if (!image.LoadImagePNG(szFileName, colorkey)) {
        g_debug("Image can't be loaded: %s\n", szFileName);
        return false;
    }

im thinks if the file does not exist here as its will happens on bmp or jpg, then glbasic would simply just shutdown on some devices.

Also you dont need to use Check_Assests() commands at all anymore, this happens automatic when loading files.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
Thanks! Yes - I did an immediate "return" within checkassets to ignore it.

Great! I never use jpg or bmp anyways...which file do i replace this in? nevermind: did a search and found in lib_glbasic.cpp
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
    if (!image.LoadImageBMP(szFileName, colorkey) && !image.LoadImagePNG(szFileName, colorkey)) {
          g_debug("Image can't be loaded: %s\n", szFileName);
          return false;
    }

do also still works too (bmp and png), so there is something monkey with the JPG loader that might crash for some reasons on some devices.

So until then do NOT use jpg in your android project.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
What is best way to refresh - reload the GLBASIC editor version to the A Studio - so that I don't run older version?

 - Refresh linked C++ files
- Rebuild Project
- Build app

*takes long time*
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
you should only need to build once, which is what im have do (but here im also have not touched glbasic when testing your projects). So its should only been the first time that might take anything from 3-10 minuttes to create the build folder.

If you change something, AS should automatic reflect to that. But its mightbeen a good idea to rebuild just before the releaase version.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
4.197 4576-4576/? D/hidapi: Initializing Bluetooth
08-20 11:59:54.198 4576-4576/? D/hidapi: Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH
08-20 11:59:54.221 4576-4576/? I/glbasic: SDK: 22
08-20 11:59:54.221 4576-4576/? I/glbasic: dataDir is /data/data/com.gazzappergames.breakerbricksprem/files
08-20 11:59:54.221 4576-4576/? I/glbasic: External data dir is not found or not got permissions. Im using internal data dir instead
08-20 11:59:54.221 4576-4576/? I/glbasic: ext_storage is /data/data/com.gazzappergames.breakerbricksprem/files/
08-20 11:59:54.223 4576-4576/? I/glbasic: Java_org_libsdl_app_SDLGlbasic_setFilesPath
08-20 11:59:54.224 4576-4576/? I/glbasic: Running on a non-TV Device
08-20 11:59:54.225 4576-4576/? I/glbasic: deadzone is: 500
08-20 11:59:54.727 4576-4576/? I/glbasic: OnResume()

Some reason looking for Bluetooth and file directory problems then further down...

08-20 11:59:56.011 4576-4597/com.gazzappergames.breakerbricksprem I/glbasic: =   /data/data/com.gazzappergames.breakerbricksprem/files/Media/Media

Also java call size is still running when I removed the checkasset code from source GLB editor - so not resetting correctly.



Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
Im do mean im just checkling you have the permission of not. Its should gracefull skip if not used.

The java calls size and copy is still called, but this is just called internal when you want to access a file, but this is happens automatic rather than manual.

its still required in order to copy the files from the apk to the internal memory.

This was added years ago when im got the source code first time and intergrated the javacalls from some of the official file commands.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
also, libs_glasic.cpp has many more JPG related references...so if the JPG type is crashing  - are they okay to use?
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
checkassets is taken out of my project (ignored by code)
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
yes, but dont worry about those jpg references. They only used when loading them. im not sure why its happens. Hopefully fixing it later (etc taking a look into that function).

you just dont need to checkassets manually anymore, so remove them from LOADSPRITEz as glbasic calls them automatic by any file access. This was fixed since im got the source code as im integrated that in some glbasic commands. Same with screen orientation.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
until im got it fixed, you can just after this function:

bool OPENGL_IMAGE::LoadImageJPG(const char *szFileName)

just do a return false right after the function. then any load reference will not use jpg loader.

Hopefully im can get its to gracefull return its correctly and just dont try to read the file if its not a jpg.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
until im got it fixed, you can just after this function:

bool OPENGL_IMAGE::LoadImageJPG(const char *szFileName)

just do a return false right after the function. then any load reference will not use jpg loader.

Hopefully im can get its to gracefull return its correctly and just dont try to read the file if its not a jpg.

Cool - now it runs - but the media directory is not found or in wrong place - no assets loading.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
dont change the java file with size/copy, howover how should the game title look like?
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
If you just see small text on menu then assets didn't load.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
Like like im cannot fix it at all :-( and im so much hate Android Studio as connection with emulators is so unstable like hell (xCode in this case was so much much better). So im dropped them and only have tested on the phone.

Anyway im could get the assest files to loads as intended as seen in logcat, but even they are loaded, they are still not shown at all. Here im cant do anything more with it currectly as im is not sure what its happens.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-20
No probs - take a break from it :)

I will tinker with my version and see if I can figure anything out...looks to me like a Create "Media" folder is not behaving as it should.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-20
Not sure its the case as the game loads very fine with all assets files on a Android 9 phone (api 28), on a Android 7 tablet (api 24), but not on the Android 5.0.1 phone with api 21 (app runs still runs).

About the assest loadaing fail im cannot do anything more, hopefully Gernot have a clue. As least you do might can do a gracefull quit.

Also im have do a better ImageLoadJPG code, so its does now checks jpg and JPG extension when LoadImageJPG is invoked, so its dont breaks combatible (im do should have do a ifdef ANDROID throught).
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-21
There is nothing issue with the jpg as png image load also bork out too! So there must been something with the file system to do why the assets loading not working on Android 5...... So while png diddent crash due that, then jpg do.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-21
Just thought of something - I only have write permission - perhaps API21-22 requires both read and write :)
Write only implies both as of later versions of APIs - or so I think I read.

I will try later with read and write permissions in manifest - maybe asset load will work then?
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-21
Android is just so much strange as hell and confucsion some time. Currectly im have absolute no idea what its up and down with android 5 at all why its suddently happens. No files seens read & write to the folder at all.

This even im routed it to a external directory where im actuelly can see the images got copied over to it as its should on the Android 7 device.

So not sure what happens with Android 5 and might have something combatible breaks with AS throught me thinks.

Me thinks its more a Android Studio bug and google some how have broke combatible, but Android 5 is also quite old as well anyway. So im might even leave Android 5 and require Glbasic projects to use a least api 23 (Android 6), as your game works nice on Android 6.

PS. DONT update to AS 3.5 as this version is incombatible with glbasic steam Android projects (hopefully fixing later).
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-21
Got my Android Studio running quite fast now.

I have 16GB of RAM so I allocated 8GB in VM mem settings to AS and enabled parallel processing and disabled bloaty Plugins.

Running much better now.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-21
I'm Uninstalled it, but I'm do try again Saturday or Sunday with a complete fresh install and try to get greedy mouse running. But im is totally done with andoid 5. I'm do now only help with api 23 and over. Rest is too old.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-22

Noticed this - might be nothing but it looks strange...

I modified the Media folder to media (lowercase) trying to see if that was the cause...

I noticed before on logcat a double mention of the media folder in a path name

08-22 10:03:14.489 4481-4551/com.gazzappergames.breakerbricksprem I/glbasic: attempting to recursiveCopy asset: Media/media



Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-22
Don't worry about the double media path at all and should not call it anyway. will just skip and have nothing to do at all. It's best practical to use Media, not media. The recursive copy should not been happens anyway.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-25
Hopefully a step further to solving this File Issue for api 22 - 5.x

Updating Studio app settings to API-19

 minSdkVersion 19
 targetSdkVersion 28

 arguments "APP_PLATFORM=android-19"

Then add use function for loading assets similar to old AE methods, like so:
LOADSOUND GETCURRENTDIR$()+File$, ID

So loadsound is now working but something is preventing the same solution from Loading FONTS and SPRITES

So that leads me to believe the underlying code for LOADSOUND is treating assets different than LOADSPRITE.

SF, does this help you to figure out the difference between LOADSOUND and LOADSPRITE / LOADFONT

:)





Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
It's more the gl file system that not working as excepted.

Now in Android 5, datapath is correct, but fails to load. But now in Android 8, it's still fails to load as datapath set by Java is mismatch and SETCURRENTDIR() simply just don't want to work......


I'm using 3.4.1 and have cleaned up path checking and copy assets code. Etc its does no longer auto setdir to Media folder, unlike the Windows version.

Copy assets seens works on both systems, but assets stills fails to load. Weird.

Due this, I'm have sent a project or your to a gernot to take a look why SETCURRENTDIR() not working when using full path.

Also DOESFILESEXISTS() might also crash too, if c++ file checking is used. But not when only doing using Java.

Datadir is different on andoid 5 and 6+
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-26
I was weird that sound assets were loading for me, but not graphics.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-26
Also, if you need any help or want me to try anything just let me know - I am keen to get this working!
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
Im think im have finally found the main issue of the Android 5 :-D what its really happens, but im do just not sure how im will fix it, but im do know the main reason:

The files does simply just not closed correctly when its try to open op the next format in order, here bmp, png and to the last jpg. So if you try to open a png, then its try first open it as bmp, but then its fails, the glbasic try to open op on png and so on. But actuelly this can crashout on system instead.

What we needs to do a file ending checking on each loader and do NOT try to open op a wrong format, then its would work. So now im finally knows what its happens with the file system.

btw if im removed bmp and jpg from trying to load, then the png files actuelly loaded.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-26
YAY! When for the fix   :booze:
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
not extractly that throught :-(.....

But more future testing, its just bmp files that loads very fine, while both png and jpg does not works on Android 5.

This is what im came with and im have no clue what its does in the png loader, so Gernot might need to help here. But its all about to getting the png and jpg to work again. bmp files works fine.

Im have pm you the project, so you can see, where im have changed the back.png to back.bmp, and that one loads fine (and that also why font also loads as they was in the bmp format too), while all pngs might fails.

So nothing about file permissions and im also removed the Setcurrentpath("Media/") as on android, allways best to load from main path.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
more precision, png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); fails....... Dannet. It's a libpng issue. No idea how to fix, but it's that line that Bork. Some sort of a wrong compiler setting..

BMP works actuelly fine. JPG might have crashed due above issue.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-26
Hey is the libpng library the updated one that Google requested a year or so ago...is it possible the old version of the libpng is in the project?

Can't seem to locate the libpng file - maybe in a different place under the Steam version?

Or is it combined in another lib file?
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
We use the latest possible security version and we use the source code version of it, so no precompiled libs is used. But not sure why it's fails on andoid 5, while it's works on later versions, except we do use a newer compiler, which can also been the reason. etc wrong build compuiler configuration.
Title: Re: Android - has anyone tried yet?
Post by: erico on 2019-Aug-26
warning!...a wild hunch approaches....

Could it be that certain settings on the PNG and JPG creation are causing trouble?
Like if the file is not generated a certain way it will fail security and not load?

Sorry if it sounds stupid, but I have to try to chip in one way or the other. :)
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-26
Im thinks PNG fail is more the why while jpg crash because the file seens not have been closed correctly (its still open). so im believe when possible to get the PNG compiling to work, then jpg would do too. So jpg has not a focus at all yet.

my believe is there is some compiler setting (libpng is wrote in c, not c++) issue as some source code require some compiler settings sometimes to get it working property. Im have no really clue here what settings its want and where to set it. its do weird as its does work on Android 6.0, but could simply due how the compiler compiles and works.

As its per now, the file will NOT open, etc its fails to set a pointer to read the file and libpng code does not out a error, so im have no clue what to do and what a kind of error its is. That would been nice. Im just hate when no error output is shown.

There was nothing wrong with haveing GETCURRENTDIR() which might have a little bit different SETCURRENTDIR() path, both was actuelly pointed to the same folder anyway.

Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-27
Hi SF,

Just to remind that SOUND assets failed to load on Android 5.x too - until I used GETCURRENTDIR() but maybe you fixed that with your update to assets copying etc.

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-27
as allready tried various ideas with that kind (one assets loaded in different ways as other). also bmps does works, but not png, and its dont output a error from libpng or dont know how to get it output its error.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Aug-29
Let's know when you or Gernot have a fix for this ...
I am keen to fix a bug in one of my Android apps - but need to have the Asset load issues sorted beforehand. :)
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Aug-30
waiting also, but dont hold your breath as Android 5 is actuelly old (Android 10 is close to release), and you could reenable it again when its got fixed, or by only use bmp files if png did not got loading (you can check if a sprite got loaded or not).

This is a libpng issue and no idea what to do without seing any errors why.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Sep-04
Maybe Gernot can figure out the compiler issue?  :noggin:

I am on holidays soon and wanted to update a bug in an app, looks like android won't be really ready for while yet.

I might try update an app with a small userbase and see how it goes...can't risk this yet on apps with tens of thousands of users.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Sep-04
Apple do force update as well. For best practical simply set Api to been minimum Android 6.0 by now. When/if its got fixed, then a another update can been done to enable Android 5 again. By now im do still have focus on a Spectrum Next game.

Anyway if im do port Genius Greedy Mouse again to Android, then im would require Android 6+ anyway. For me missing Android 5 is not a biggue at all.

But if you can, convert all your images to bmp (its not much bigger than png when compressed to the apk really). yes you might miss some features, but just disable those.

You game was still playable by using bmp for the title screen and then playing the b&w version.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Sep-04
im have wrote to gernot as im cant do anything with it and not sure how to do it sadly why libpng fails to open as its diddent out error, but have not checked it due im got distracted by a game named "Tyvarian" on Spectrum Next.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Sep-05
just seen this share:
https://www.counterpointresearch.com/nokia-leads-global-rankings-updating-smartphone-software-security/

Look like some producets fails to update thier phones completly. One of produce is one of them im have and they are often cheap phones. So im cant say dropping Android 5 is a big issue if you ask me.

But is a issue im my self cannot fix. Have wrote to Gernot. So its up to him if he can fix that png issue. Im cannot promise.

But sooner or later Google depreacting Android 5 anyway on the Google Play. Android 4 is got depreacted on Google Play and is no longer updated.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Sep-19
My worry is the that the png issue also might affect other models or android versions or a combo of Android x with Phone model y.

If Gernot could find the cause, then there might be a chance to fix it and keep the backward compatibility intact.

Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Oct-11
backward compatibility has allways been bad on both Android and iOS. Its reason im dropped out.

Dont except this to been fixed soon. You might still want to use the old Android SDK for Android 4+5 support and use AS  for Android 6+ support. Google Play supports multiply APKS, but not checked how that works.

But dont constatly asking for backward compatibility as im previous has declare Android 5 to been depreacted as least from mine side. Im havent seen issues with Android 6 as least not on the devices/emulators im have tried it on.

Also you could also using the old Android SDK for Android 4-5 if you want backward compatibility as Google supports multiply APKS (have no idea how this works througth as not checked). So except to remove SDK checks for Android 5 and below in AS to clean up the code.

But a great news is Android Studio 3.5.1 works very fine as well. Might need to clear and let grandle update and resync, but works fine.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Oct-11
my believe its property a compiler setting issue with a newer compiler.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Oct-11
Some good news on the Admob Interstitials....I have them working with the latest Admob SDK version, but only between app switching on the paused game screen.

I need to find a way to open the Advert in the SDL running game...


Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Oct-11
cool. yes  the game need to send pause() and unpause() before sending a advent as we invoke a another Activity.

Also bad news. Google has broken Android 5 support in Android Studio 3.5.1, so no more Android 5 request please.

Code: (glbasic) [Select]
compileSdkVersion 29
minSdkVersion 23
targetSdkVersion 29

But The best bet is using both Android Classic SDK for older versions and Android Studio for Android 6+ projects and do a bundle apk (a area im havent looked into).

Btw im have forced to disable the SDL Audio which also got broken for Android 5 in AS 3.5.1 (Nice job, Google) and added a notify to the user if Android 5 or below is detected. The changes is sent to Gernot. Im sadly believe Libpng 1.4 is not supported in the newer AS at all as SDK tools etc has been updated.

But has not seen any issues from Android 6 throught.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Oct-11
No probs!

Any tips on creating/invoking a new activity within SDL would be great :)
I am not a java man - but picking up bits as I go...
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Oct-12
learn Java, hehe. Im did do some java games back in about 20 years ago or such. Acticity is a little bit strange on Android, but property do have better time in this week.

Howover what im seen is its a issue with the newer compiler used with libpng, but no idea how to fix as im dont know hot to do a error handing. In Android Studio 3.5.1, the SDL Sound does no longer works, which seens to been a bug in the emulator? Im do easy can skip it as im did as SDL Sound is actuelly not important and eventuelly could use SoundPool instead.

Howover we dont have all those grandle update issues as im previous sat in 3.5.0 at all. Took some time, but was no problem when first finished updated.

!!! Btw for Android 5.0, PNG, JPG and SOUND does NOT work for Android 5.X !!!
The app can do run !!! Have not seen issues yet with API23+
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Oct-29
I got SOUND and music working on Android 5.x it was just a media folder issue for sound.
I just could figure the png issue.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Nov-06
i have a ads working when users jump out of the app and such - its not ideal - but okay for now...*makes same money roughly*

A proper, GLB firing of the ads via glb_javacall would be super - whenever SF has time to look at it...
I tried myself but found little on the interent and my lack of java / android concept knowledge meant I kept making mistakes...

Title: Re: Android - has anyone tried yet?
Post by: erico on 2019-Nov-07
Nice, so most of the trouble you were having is solved.

About *makes same money roughly*, you mean publicity during game against just when exiting app?
Interesting, the later seems interesting if it does not disturb the gameplay.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Nov-08
Yes - I noticed players on youtube often jump out of a game or app mid play or when they die, in order to send a text or open something else...this is when the ad shows.

I can make it so the ad show right away when they do that but they are prompted to continue playing or quit fully, or I can wait for them to return to the app then show them. Currently using the former but the next app I will try the latter - just to see the difference.
Title: Re: Android - has anyone tried yet?
Post by: spacefractal on 2019-Nov-11
You are under risk to get your admob account disabled by using ads this way. do newer ever use ads on a app exit (people can report it, and then you might get its disable if that happens):
https://support.google.com/admob/answer/6201362

Also when a ads show, the previous activty (your game) is got paused and then resumed.

For  the javacall from glbasic, its is sent to public static String glb_JAVACALL(String url) in SLDGlbasic.Java. The Android Extras Java calls should still works. Its hasent changed at all here.

Howover long time ago im checked this last time really.
Title: Re: Android - has anyone tried yet?
Post by: MrPlow on 2019-Nov-16
I will soon post how I got the ads working in Pause or Jump out of app :)