GLBasic forum

Main forum => Bug Reports => Topic started by: MrPlow on 2020-May-21

Title: Android compile error
Post by: MrPlow on 2020-May-21
When compiling a new clean project
=======================
Build command failed.
Error while executing process C:\Android\android-sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Lenovo\Documents\GL_PROJECTS\GLBasic\NEWGAME\distribute\android_studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Lenovo\Documents\GL_PROJECTS\GLBasic\NEWGAME\distribute\android_studio\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-23 NDK_OUT=C:/Users/Lenovo/Documents/GL_PROJECTS/GLBasic/NEWGAME/distribute/android_studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\Lenovo\Documents\GL_PROJECTS\GLBasic\NEWGAME\distribute\android_studio\app\build\intermediates\ndkBuild\release\lib APP_PLATFORM=android-18 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}

usage: ldflags_to_sanitizers.py [GLOBAL_FLAGS] --module [MODULE_FLAGS] [--module [MODULE_FLAGS]...]
C:/Android/android-sdk/ndk-bundle/build//../build/core/build-all.mk:94: Android NDK: WARNING: There are no modules to build in this project!   
C:/Android/android-sdk/ndk-bundle/build//../build/core/setup-toolchain.mk:127: COLOR\distribute\android_studio\app\jni\Android.mk: No such file or directory
make: *** No rule to make target 'COLOR\distribute\android_studio\app\jni\Android.mk'.  Stop.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-21
Okay, might have solved the problem for now...

Seems the Android build process does not like [spaces] in the parent project folder  =D
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
property "" is missing somewhere. this is normal with spaces when those is forgot. no idea where.

Which path was it? Im should warns about it in the glbasic compiler if a space is used.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-22
It was the GLB project folder name - the parent of the GLB code

Also, KEY(1) is not working for me now

Also ad show with javacall is crashing for me - is there something I need to add for new changes you made to interstitial ads to work?
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
I'm haven't touched the KEY()? Im did do fighted to get right java ads file (that one that only uses init() with no arguments. For any ads relative crash im do need the full log from the logcat around the crash, or im have no change to take a look what happens.

here Spot Race does also not works with ads too, but PowerUp Elevation does works. This is just a fault from my side as the ads init ID seens have been changed or strings.xml got resetted.

Also do NOT touch any glbasic relative sound or graphics commands in both SUB GLB_ON_PAUSE: and GLB_ON_RESUME: functions at all (even FPSLIMIT might crash)! If you do that, then its might crash when you show a ads or when you quit it! Im did warn about that througt.

This was the key issue why im choosen to added soundpool for alternative music player (just a change in strings.xml needed), so java automatic could pause and resume it...... not currectly possible with sdl_mixer (as its will crash).

Also JavaCall$() is no longer usable, but just rename and use JavaCall2$ instead.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-22
I did the Javacall2$ fix already - i will try load and init the ads myself to see if I can fix.
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
here its seens all works fine, but Google did ineeded updated version number in build.grandle. Could been the reason? (com.google.android.gms:play-services-ads:19.1.0). im might have forgot to update that in steam, but did also mention that too.
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
you can see if its a http fail if you do not use any filters in the logcat. then any fails would been shown. howover there was a crash when tried to load admob on a android tv, which is unsupported.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-22
I doubt it is the SDK version for Admob - as I was many years using very old SDKs without issue...
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
Yes it's can. Don't use old version really. Not with as.

Foe the init issue, I'm need the logcat. Output of logcat still works in as when launch the retail version.

Debug ads might not work with retail unit id. They will fails loading. But should not crash.

That android tv crash will been fixed in next update. anyway im havent touched KEY(1). remember its a toogle, so send it to variable. This was to prevent back to been multiply pressed as its should not do that. This has been that very since beginning.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-22
Variable toggle?

do you mean

Code: (glbasic) [Select]
LOCAL backbutton%
backbutton = KEY(1)

if backbutton...
Title: Re: Android compile error
Post by: spacefractal on 2020-May-22
Here its works as intended and used back for backtrace from ingame -> pause -> menu -> quit and works perfectly when testing here. You might still use it improperty?

Also has you used ALLOWESCAPE FALSE or has used that command at all? On Windows is set to ALLOWESCAPE TRUE by default, but you cant do that on Android, where ALLOWESCAPE FALSE is required.

On Android im generally do something like this for KEY(1) for a proper use of it:

Code: (glbasic) [Select]
?IFDEF ANDROID
IF KEY(1)=1
IF S_Status$="Play"
LOCKSELECT=1
S_Status$="Pause"
ELSEIF S_Status$="Pause"
S_Status$="Menu"
ResetGame()
LOCKSELECT=0
GameStatus$=""
ELSEIF S_Status$="Menu"
DEPRINT("end()")
END
ENDIF
ENDIF

Howover keyboards on emulators is disabled throught. So you can do try to move
if (SDLGlbasic.GetDeviceName(event) == false) return keyCode;

To down just above
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) keyCode = KeyEvent.KEYCODE_BUTTON_A;

But touch presses should not been a keyboard. 
Title: Re: Android compile error
Post by: MrPlow on 2020-May-23
Admob error crash logcat

I cant be sure but looks like its related to

SDL main line 1503
        SDLGlbasic.nativeSetup(); //****GLBASIC****
        SDLActivity.nativeRunMain(library, function, arguments);
Title: Re: Android compile error
Post by: spacefractal on 2020-May-23
Hmmm.

Look like you have imported android_JAVACALL wrong? That import was correct and should not been renamed, unlike the helper function. So import and function should look like this:

Code: (glbasic) [Select]
?IFDEF ANDROID
IMPORT "C" const char* android_JAVACALL(const char* string)
?ENDIF

FUNCTION JavaCall2$: callStr$
?IFDEF ANDROID
STATIC res$
res$ = android_JAVACALL(callStr$)
RETURN res$
?ENDIF
ENDFUNCTION

This can also been the reason for the crash as android_JAVACALL2 import does not exists.
Title: Re: Android compile error
Post by: MrPlow on 2020-May-23
Doh!

Great stuff! At least that looks to be sorted. :)