BMX-NG Android.

BlitzMax Forums/Brucey's Modules/BMX-NG Android.

Richard Betson(Posted 2015) [#1]
Hi,

I hope this is the right place to ask.

Where can I get information on how to compile for Android? Or can it yet?

Anyway, way lost.


Brucey(Posted 2015) [#2]
I still need to write some proper documentation for it (as you can tell).


I'd start with making sure everything is working normally first.
For example, if you intend trying out your USC project on Android, I'd spend some time checking that you can do a Windows/etc build for it.

You will be using the SDL graphics backend, so you may want to experiment with that too, particularly SDL.GL2SDLMax2D, which will be your Max2D module.
SDL also handles all your input/events. There is also an SDL-based FreeAudio module (SDL.SDLFreeAudio) for driving the sound.


I'll try and get some documentation together shortly.


Richard Betson(Posted 2015) [#3]
Hi,

Well, I have got my Phoenix USC demo running and compiled with bmx-ng in 64bit (Cool). But I had to strip out Vertex's BnetEx and Oddball's oddmod (OpenGL in this case) to get it to work. I am trying to sort out the problems with those mods which is a bit of a slog. But my code (frameworks) compiled with little trouble (still a few issues to smooth out). So I thought about trying to get it to compile on Android after getting it to compile in 64bit although crippled.

One issue I am having is that I get an error indicating folders/directories can not be made, for example this:
Error creating libs abi dir 'C:/Programming/Phoenix_USC - Copy/android-project-clientf/libs/armeabi'

Is this a permissions issue? At any rate I will make sure I have the above mods installed and compiled. I'm in no rush and I can certainly wait for an outline on use.


Brucey(Posted 2015) [#4]
Do you have a link for bnetex?

The OpenGL stuff will need to be OpenGLES-friendly if you intend using it on Android.

One issue I am having is that I get an error indicating folders/directories can not be made

It may be the space in the path?


LT(Posted 2015) [#5]
I'm interested in getting my engine working on Android, also. It's OpenGLES-friendly, I believe. One question...I'm using MaxGui for a simple console. Is there some equivalent on Android?


Richard Betson(Posted 2015) [#6]
Hi,

Ya, here is the link for BnetEx. It's in German but the download link is right there. I just use Chrome to convert the docs to English.
http://vertex.dreamfall.at/projects.php#bnetex

But hold up before looking that over as I've just been handed a link to a version that may be bmx-ng ready. In testing it for Windows I can see it needs a few more modifications. For example when using Mingw64 I think I need to include c-lib winsock2.h . Another issue is "@" in strings which trigger a "Stray "@" in Program" error. Is there a compiler directive to allow them?

I suppose I can ditch oddmod if I can come up with a function to rotate the display (images) as oddmod does which is why I use it. Now would be the time to do that. I'll take a look at oddmods source to see how rotation is done there, maybe it's something I can export.

You might be right about the white spaces. Duh. ;)


videz(Posted 2015) [#7]
I have an upcoming Android prototype project as well. I'm contemplating between trying Monkey-X MiniB3d and this version with MiniB3D.

Any updates Brucey on where to start?

Thanks.


Brucey(Posted 2015) [#8]
I've rewritten the android stuff in bmk.
It's now *much* easier to get working with the default (an ndk and sdk dir) setup.

Basically, all you need to do is configure some settings in custom.bmk, and start building...

Here's an example
addoption android.home "/PATH/TO/SDK/android-sdk-platform"
addoption android.sdk "/PATH/TO/SDK/android-sdk-platform"
addoption android.ndk "/PATH/TO/NDK/android-ndk-version"
addoption android.toolchain.version "4.9"
addoption android.platform "12"

That's the minimum settings you need to build something.
Toolchain and platform you can choose from the available ones in your NDK.

The app build itself it pretty basic, as far as customisation goes, and I'm not entirely happy with its configurability yet.
You can create an application settings file (per app) with some values that will be applied to the build, using the name: APPNAME.android
Example contents:
# application package name for Java class
app.package=net.brucey.android.digesteroids

# application version code
#    An integer value that represents the version of the application code, relative to other versions.
#    You can set the value to any integer you want, however you should make sure that each successive release of your application uses a greater value.
app.version.code=1

# application version name
#    A string value that represents the release version of the application code, as it should be shown to users.
#    The value is a string so that you can describe the application version as a <major>.<minor>.<point> string, or as any other type of absolute or relative version identifier.
app.version.name=1.0

app.name=Digesteroids
app.orientation=landscape


I'm certainly not an expert when it comes to android config, so there's probably a lot more we can do to make things better...

In theory, you can build multiple architectures (eabi5, 7, etc) into the same apk, for deployment onto different devices. You can build your app for each, individually, and bmk should package them up into a single apk for you.

@minib3d
Unfortunately, MiniB3D is not OpenGLES compliant, so that's a non starter.


Scaremonger(Posted 2015) [#9]
Hi,

Starting with a simple "Hello World.bmx" piece of code:
print "Hello World"

I get the following error:
Building Hello World
Error creating libs dir 'E:/ANDROID/FIRST_BMAX/Hello World/android-project-Hello World/libs/'
Process complete

Although it has created the folder!

What do I call the application settings file?


Brucey(Posted 2015) [#10]
See if you get further without spaces in your paths.

The settings file is APPNAME.android. Again, probably better not to use spaces in the name of your app.


RustyKristi(Posted 2015) [#11]
Hey Brucey, I got BMX-NG installed with your OpenB3D and SDL mod. works perfectly with 32 and 64 build, really nice!

but same error here, do I place the custom bmk beside the bmx file that I'm building? I used keyboard.bmx as the main file name from sdl example.

and I hope OpenB3D makes it to your Android build soon. :)


Derron(Posted 2015) [#12]
Project specific bmkfiles:

YourProject/pre.bmk
YourProject/outFile.bmk (eg. MyGame.bmx -> MyGameExe -> MyGame.bmk)


custom.bmk instead is loaded from AppDir+"/custom.bmk" so it calls AppDir().
As you compile this is the path to your bmk-application.



Short: place "custom.bmk" next to your bmk[.exe].


bye
Ron


Brucey(Posted 2015) [#13]
do I place the custom bmk beside the bmx file that I'm building?

No. It's a global config file which goes in the bin folder.

As Derron points out, there are some other named .bmk files that bmk looks for during a build, all in your project folder :

pre.bmk - this is loaded before the build starts.
<project name>.bmk - A project-specific post-build step. Uses the name of your executable in the file name. This is loaded after the main compilation.
post.bmk - a general post build script. Can be used for non project-specific actions.


Dabhand(Posted 2015) [#14]
I'm having a pop at building for Android too... And I think I've missed the obvious again, as I'm getting the same error creating libs folder thing... This is what I have (Screenie):-

https://onedrive.live.com/redir?resid=6791F68A23A2D1C9!428&authkey=!AHQHg0nPowjJ4WY&v=3&ithint=photo%2cPNG

Error creating libs dir 'C:/andytest/android-project-andytest/libs/'

I'm guessing I've mucked up the custom.bmk file, but alas... Havent a clue! :D

Dabz


Dabhand(Posted 2015) [#15]
Mmmmmmmmmmm

Taken from bmk_util.bmx:-

' create libs/abi dir if missing
Local abiDir:String = "C:/andytest/android-project-andytest/libs/" 'Error
Local abiDir:String = "C:\andytest\android-project-andytest\libs" 'Success

If FileType(abiDir) <> FILETYPE_DIR Then 
	CreateDir(abiDir)

	If FileType(abiDir) <> FILETYPE_DIR Then
		Throw "Error creating libs dir '" + abiDir + "'"
	End If
End If


Dabz


Dabhand(Posted 2015) [#16]
Yep... Replacing the FileType(abiDir) check with:-

FileType(Left(abiDir,Len(abiDir)-1)) <> FILETYPE_DIR

Lets the execution pass through...

Dabz

P.S. This is for Windows based builds of bmk mind!


Dabhand(Posted 2015) [#17]
Yep... Replacing the FileType(abiDir) check with:-

FileType(Left(abiDir,Len(abiDir)-1)) <> FILETYPE_DIR

Lets the execution pass through...

Dabz

P.S. This is for Windows based builds of bmk mind!


Dabhand(Posted 2015) [#18]
Right, this bit is killing it:-

' look for 64 bit build first, then x86
	'If FileType(toolchainDir + "-x86_64") = FILETYPE_DIR Then
	'	toolchainDir :+ "-x86_64"
	'Else If FileType(toolchainDir + "-x86") = FILETYPE_DIR Then
	'	toolchainDir :+ "-x86"
	'Else
	'	Throw "Cannot determine toolchain dir for '" + native + "', at '" + toolchainDir + "'"
	'End If


Doesnt matter with the above though, without the x86 and x64's, it still points to a valid toochain path in the NDK.

But this is failing too:-

' check paths
	If Not FileType(RealPath(gccPath)) Then
		Throw "gcc not found at '" + gccPath + "'"
	End If

	If Not FileType(RealPath(gppPath)) Then
		Throw "g++ not found at '" + gppPath + "'"
	End If

	If Not FileType(RealPath(gccPath)) Then
		Throw "ar not found at '" + arPath + "'"
	End If


Dabz


Brucey(Posted 2015) [#19]
Having fun? ;-)

Let me look into the Windows issues.
It's working fine on the other two platforms (yay!)


Dabhand(Posted 2015) [#20]
I am I am! :D

Well, I've managed to get it to begin compiling, though midway through, throwing an error:-

[ 32%] Compiling:SDL_androidaudio.c
In file included from C:/Users/Dabz/Downloads/BlitzMaxNGwin32_0_62_3_06TDM64bit5_1_0-2/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/audio/android/SDL_androidaudio.c:31:0:
C:/Users/Dabz/Downloads/BlitzMaxNGwin32_0_62_3_06TDM64bit5_1_0-2/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/audio/android/../../core/android/SDL_android.h:30:29: fatal error: EGL/eglplatform.h: No such file or directory
 #include <EGL/eglplatform.h>
                             ^
compilation terminated.
Build Error: failed to compile C:/Users/Dabz/Downloads/BlitzMaxNGwin32_0_62_3_06TDM64bit5_1_0-2/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/audio/android/SDL_androidaudio.c
Process complete



Everything else is just dirty paths, more notably, the NDK paths and the ones being built by bmk_make are different... Little jiggle needed!

:)

But yeah, it's nice to have a dig about, sorta get the feel of how this thing grafts!

Dabz


Brucey(Posted 2015) [#21]
Hmm, errors in the SDL build implies the NDK paths aren't right somewhere.
(I'm trying to remember when I last did a Windows Android build...)


Dabhand(Posted 2015) [#22]
Oh oh oh... Hold the phone...

Realised when faffing to make it build, I changed the platform number you recommended at the top and never changed it back after reading this (https://groups.yahoo.com/neo/groups/libsdl/conversations/topics/72078)

And... Voila:-

[ 99%] Compiling:andytest.bmx.console.release.android.armeabi.c
[100%] Linking:andytest
Buildfile: C:\andytest\android-project-andytest\build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.4.0
 [checkenv] Installed at C:\AndroidSDK

-setup:
     [echo] Project Name: andytest
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.1
     [echo] Resolving Build Target for andytest...


But...

BUILD FAILED
C:\AndroidSDK\tools\ant\build.xml:538: Unable to resolve project target 'android-19'
Total time: 0 seconds
Error creating apk
Process complete


Getting there, downloading API 19 to this if that will fix it! :)

Dabz


Dabhand(Posted 2015) [#23]
-package-resources:
     [aapt] Creating full resource package...

-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating andytest-debug-unaligned.apk and signing it with a debug key...

-post-package:

-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: C:\andytest\android-project-andytest\bin\andytest-debug.apk
[propertyfile] Creating new property file: C:\andytest\android-project-andytest\bin\build.prop
[propertyfile] Updating property file: C:\andytest\android-project-andytest\bin\build.prop
[propertyfile] Updating property file: C:\andytest\android-project-andytest\bin\build.prop
[propertyfile] Updating property file: C:\andytest\android-project-andytest\bin\build.prop

-post-build:

debug:

BUILD SUCCESSFUL
Total time: 4 seconds

Process complete


YAY!!! \o/

Dabz


Dabhand(Posted 2015) [#24]
Shes grafting well! :)

http://www.bmx-ng.com/main/files/andytest-debug.apk

Runs lovely on my old Samsung Ace 3 thingy! :)

Dabz


Dabhand(Posted 2015) [#25]
So Mr Brucey... After a night playing... I can formerly state that... It works wonderfully on Windows after a little jiggle (Noted above)... Which isnt much, so thats good! :)

Dabz


Brucey(Posted 2015) [#26]
BlitzMax on your phone, hey? Who'd have thought it !? ;-)


RustyKristi(Posted 2015) [#27]
That's great Dabhand! Can you post your custom.bmk?


Brucey(Posted 2015) [#28]
The ABI-19 issue is to do with project.properties. I may need to add a new SDK target project setting for custom.bmk, since it needs to correspond with an SDK version. As opposed to android.platform, which is referring to the NDK...

I've patched bmk with a fix for the trailing slash abiPath problem.

The "look for 64 bit build first, then x86" section was not a problem for me, as the folder has a -x86_64 suffix here.
Does it have nothing for you? ( eg. ... android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 )


RustyKristi(Posted 2015) [#29]
Hey Brucey,

I think it will be a better idea on using CMAKE now since BMX/BMX-NG is opensource and it's targeting multiple platform/arch. There's scons and bjam but CMAKE is the go to for automating build process and generating required files like custom.bmk and other files.

Or at least any batch or script file to do some checking and create these required files. :-)


Dabhand(Posted 2015) [#30]

That's great Dabhand! Can you post your custom.bmk?



Will do...

http://www.bmx-ng.com/main/files/bmk.7z

I'm gonna make a coffee then package this up into the binary on bmx-ng.com


The "look for 64 bit build first, then x86" section was not a problem for me, as the folder has a -x86_64 suffix here.
Does it have nothing for you?



No matey, it just kills the build process!

Dabz


Brucey(Posted 2015) [#31]
Let me rephrase the question :-)

What does your equivalent path look like?


Dabhand(Posted 2015) [#32]
Lol... Bloody hell... Just spied this, I think I answered that one here:-

http://www.blitzbasic.com/Community/post.php?topic=105123&post=1278613

Basically the same as the ones you have... Without the suffixes tapped on... Hence why just removing the filetype check works!

Me bad... Sorry Mr H!

Dabz


RustyKristi(Posted 2015) [#33]
Thanks Dabshand, will check it out! :-)


RustyKristi(Posted 2015) [#34]
Thanks Dabshand, will check it out! :-)

Edit: why is it the bmk.exe? I thought it's custom.bmk?


Dabhand(Posted 2015) [#35]
Ah... You wanted that instead... Not at PC at minute, at gf's house... Just been woken by one of her kids crying, bloody night terrors.

Well, my custom.bmk file is the same as what Brucey put up, with the paths filled in accordingly to my SDK and NDK root folders:-

addoption android.home "C:/androidSDK"
addoption android.sdk "C:/androidSDK"
addoption android.ndk "C:/androidNDK"
addoption android.toolchain.version "4.9"
addoption android.platform "12"

That's about it really... Off the top of my head!

Dabz


RustyKristi(Posted 2015) [#36]
Building a simple print "hello" with just a project name 'hello'.

Building hello
Error creating libs dir 'C:/BlitzMaxNG/samples/hello/android-project-hello/libs/'
Process complete


I rebuild my module with Android v7a and it went successful.

@Dabshand.

I have used your custom bmk.exe and it compiles ok. it searches for:
android-ndk/.../arm-linux-androideabi-4.8/windows

instead of
android-ndk/.../arm-linux-androideabi-4.8/windows-x86_64


which the default bmk.exe uses. upload it on my emulator and actual android device (Android 4.4.2). Just exited my apps even with your example andytest-debug.apk above.

My android SDK/NDK installation works fine, I currently got it setup with another 3D engine with android platform support.

How do you really fix the 'Error creating libs' problem? :/


Dabhand(Posted 2015) [#37]
Well, if the it got past creating the libs folder and compiled, that shouldn't be an error anymore?

I have no idea why it would close matey, I've literally only played with this Android bmx-ng stuff for one night! :P

I'm at work now, sadly no PC to tinker on... Just buckets of plaster and a handboard and trowel... I'm going to delve a bit further in tonight though when I get back home!

Dabz


RustyKristi(Posted 2015) [#38]
thanks anyways Dabs, I'll just wait for the next update here and do some more testing..


Brucey(Posted 2015) [#39]
DDMS ( http://developer.android.com/tools/debugging/ddms.html ) is a good tool to see what errors the app is generating on the device.

How do you really fix the 'Error creating libs' problem?

It's a bmk bug on Windows.

it searches for ... instead of ...

As I said previously, commenting out chunks of code doesn't usually tend to fix problems, just moves them :-)

Mobile support is still WIP, and could be classed as "very new stuff", so there are going to be early teething issues with it.
Presumably "another 3D engine with android platform support" has been developed for far longer than NG, and probably with far more resources too.


RustyKristi(Posted 2015) [#40]
As I said previously, commenting out chunks of code doesn't usually tend to fix problems, just moves them :-)


Thanks Brucey, just to be clear it was Dabs bmk.exe that did that one. I used the default bmk source and it went ok now with the android eabi path.

Mobile support is still WIP, and could be classed as "very new stuff", so there are going to be early teething issues with it.
Presumably "another 3D engine with android platform support" has been developed for far longer than NG, and probably with far more resources too.



Understood. For what it's worth, it compiles on Android now and that is still great stuff :-)


Derron(Posted 2015) [#41]
You could also have a "adb logcat" running while you execute your apk on the device ... so you can read the error / source of the crash.

I assume it is something with a lib not found ... am not sure, but think I had that issue some weeks ago too.

And there was an issue with a lib not being linked at all (that one for openGLES I think).

LogCat wrote this then:



In my case it failed because of the missing symbol "AO_compare_and_swap" defined in
"libdemoapp.so".

If such a thing is happening to you too, I am quite sure Brucey has some ideas to narrow it down (he introduced me to the "nm" command :-)).


If you have various NDK/SDK installed - I had other ones because of "LibGDX", make sure which ones are set for the environment variables.


bye
Ron


RustyKristi(Posted 2015) [#42]
Is there any particular setup on how you code for Android in BMX-NG? say default resolution or other input stuff?


Brucey(Posted 2015) [#43]
Is there any particular setup on how you code for Android in BMX-NG?

You'll be using the SDL modules for graphics and input. Things like multi-touch, audio and the popup keyboard are working, but I've no idea about "best practices" yet.
I've mostly been concerned with the ground-work just to get things running on devices. Once that has stabilised, then we can look at making development on mobile a nicer experience.

You could check out the onscreen_keyboard.bmx example in the SDL module examples, for an idea of how to handle the mobile app life cycle events. SDL implemented it via a callback - in reality if you were doing this in Java, you'd add some OnSomething() methods.


I am currently working on fixing the niggly issues in bmk android configuration.


Dabhand(Posted 2015) [#44]
Lol@thebrucester!!!!

I know mate, I was feverish and proper excited! :D

Cannot blame a man who sees his face language running on mobile... I was like a kid in a sweet shop! ;)

Dabz


RustyKristi(Posted 2015) [#45]
Thanks Derron. btw, here's my build log if any chance I have missed something..

http://pastebin.com/ZhwsVBFd

It builds perfectly and just a
print "hello world" : waitkey
fyi..

@Brucey

Ok if that's the case, I only got the default mods like pub, brl and maxgui. I disabled Build GUI app and took out SDL before. I will try to include again and test some examples. thanks


Brucey(Posted 2015) [#46]
SDL implements all the integration between BlitzMax's C code and Android's Java.

Your error is probably (at least) something like a ClassDefNotFoundException.

The same applies to iOS and Pi support - it's all built on top of SDL.

:o)


RustyKristi(Posted 2015) [#47]
Tested the SDL onscreen_keyboard example, builds ok but exits when you launch it, here's the log:

http://pastebin.com/tKNsKrtC


Brucey(Posted 2015) [#48]
Everything there looks fine, but you'd need to show the actual device debug log as it shows app startup errors etc.

Since linkage only occurs at runtime, missing items generally only show up then.


RustyKristi(Posted 2015) [#49]
Ok thanks. here, I'm using bluestacks emulator to test/connect and log so there's that gamepop thing in the mix..

http://pastebin.com/CCNaHC4S


RustyKristi(Posted 2015) [#50]
Wow ok! :D :D :D it works on the actual device! Awesome!!! Not compatible with the emulator I guess? :P

Edit: Upon exiting and running again, I can't bring up the onscreen keyboard for some reason and you can't trigger the exit but it still runs :-)


Brucey(Posted 2015) [#51]
Upon exiting and running again, I can't bring up the onscreen keyboard for some reason and you can't trigger the exit but it still runs

The app doesn't quit when you push it to the background - that's perfectly normal.
The example was tested on iOS. On Android however, it doesn't appear to remember keyboard state, so we probably need to add an extra test on wakeup to see if we were editing at the time, and bring up the keyboard as required...

Obviously, if you intend to write an app that works across many different platforms, you'll need to adapt it in places depending on the platform.

In fact, you might look at implementing your game "framework" differently if you wanted mobile support as well as desktop - so that you needed to make less fundamental changes to get things working on mobile.

But it mostly works without too many changes, which is nice :-)

I also made a virtual touch-based joystick that you use for on-screen controls. I patched it into the digesteroids sample and it works okay.


Dabhand(Posted 2015) [#52]
Right Mr Bruce... Not sure if your playing with this...

But, I've downloaded the x86_64 Android NDK, and installed it next to my x86 one...

Edited my custom.bmk file accordingly, with a new option:-

addoption android.home "C:\AndroidSDK"
addoption android.sdk "C:\AndroidSDK"
addoption android.ndk "C:\android-ndk-x64"
addoption "{$BLITZMAX-NG_ROOT_DIR} "x64"
addoption android.toolchain.version "4.9"
addoption android.platform "12"

Then uncommented that bit you were going absolutely berserk with ;)

Print "Determining Android NDK architecture..."
	If processor.Option("android.ndkarch", "") = "x64"
		'look For 64 bit build first, Then x86
		If FileType(toolchainDir + "-x86_64") = FILETYPE_DIR Then
			toolchainDir :+ "-x86_64"
		Else If FileType(toolchainDir + "-x86") = FILETYPE_DIR Then
			toolchainDir :+ "-x86"
		Else
			Throw "Cannot determine toolchain dir for '" + native + "', at '" + toolchainDir + "'"
		End If
	EndIf
	
	Print processor.Option("android.ndkarch", "") + " Android NDK found."


Now, I can jiggle between the plain old x86 NDK and x64 NDK at a whim!

It all works and compiles great with both!

Probably be able to remove that "-x86" check now and move it down to check if there is a valid path with or without the "-x86" suffix (When ndkarch is "x86"

EDIT:-

Like...

Local toolchainDir:String = processor.Option("android.ndk", "") + "/toolchains/" + ..
			toolchain + processor.Option("android.toolchain.version", "") + "/prebuilt/" + native
	
	Print "Determining Android NDK toolchain architecture..."
	If processor.Option("android.ndkarch", "") = "x64"
		'look For 64 bit build first, Then x86
		If FileType(toolchainDir + "-x86_64") = FILETYPE_DIR Then
			toolchainDir :+ "-x86_64"
		Else
			Throw "Cannot determine toolchain dir for '" + native + "', at '" + toolchainDir + "'"
		End If
	ElseIf If processor.Option("android.ndkarch", "") = "x86"
		If FileType(toolchainDir + "-x86") = FILETYPE_DIR Then
			toolchainDir :+ "-x86"
		Else If FileType(toolchainDir) = FILETYPE_DIR Then
			'Do nothing, she's alive!!!
		Else
			Throw "Cannot determine toolchain dir for '" + native + "', at '" + toolchainDir + "'"
		End If
	Else
		'
		Throw "Cannot determine toolchain architecture, please check the line 'addoption android.ndkarch' in custom.bmk"
	EndIf
	
	Print processor.Option("android.ndkarch", "") + " Android NDK toolchain found"



It's been bugging the life out of me all day that has! :D

Dabz


RustyKristi(Posted 2015) [#53]
Yes, that's great Brucey. I'm still wondering why it does not work well with bluestacks, usually it's 100% compatible.

A working virtual joystick would be nice, where can I find the example?


Brucey(Posted 2015) [#54]
A working virtual joystick would be nice, where can I find the example?

In the virtualjoystick.mod examples folder, with the SDL stuff.

usually it's 100% compatible.

Their website says 86% :-p

I've no idea why it isn't working with that. You could always try adding more debug in custom.bmk with :
setccopt moredebug -g

and rebuild everything.

This should make the compiler generate symbols and debug information, which may improve the backtrace detail. Otherwise, there's not too much to go on, other than it appeared to segfault in SDL...


Dabhand(Posted 2015) [#55]
Quite a few "write once build for all" languages don't work with bluestacks, I give up trying to use it ages ago!

Dabz


RustyKristi(Posted 2015) [#56]
I mean with the custom work that I have done with other frameworks/engines (I'm not talking about Unity btw ;-) ) and it's expected with the android port in this early state.


Dabhand(Posted 2015) [#57]
For anyone wanting a quick spin... I've wrote a little "How-to-guide" on building for Android using my download link (Which now contains the SDL.mod" folder:-

http://www.bmx-ng.com/main/tutorials/building-for-android/

It's proper "step by step"... Any bother then let me know!

Dabz


TomToad(Posted 2015) [#58]
I tried installing Bmx-ng for android according to the instructions at the link above. The Firepaint App compiled fine. However, it wouldn't run on an actual Android device. The debugger shows this:
10-21 06:13:54.834: I/ActivityManager(872): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=net.dabz.test.firepaint/.BlitzMaxApp (has extras)} from uid 10002 on display 0
10-21 06:13:54.961: I/ActivityManager(872): Start proc net.dabz.test.firepaint for activity net.dabz.test.firepaint/.BlitzMaxApp: pid=24419 uid=10174 gids={50174, 9997, 1028, 1015} abi=x86
10-21 06:13:55.120: E/AndroidRuntime(24419): Process: net.dabz.test.firepaint, PID: 24419
10-21 06:13:55.120: E/AndroidRuntime(24419): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/net.dabz.test.firepaint-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libfirepaint.so"
10-21 06:13:55.120: E/AndroidRuntime(24419): 	at net.dabz.test.firepaint.BlitzMaxApp.<clinit>(BlitzMaxApp.java:10)
10-21 06:13:55.154: W/ActivityManager(872):   Force finishing activity net.dabz.test.firepaint/.BlitzMaxApp
10-21 06:13:56.306: W/ActivityManager(872): Activity pause timeout for ActivityRecord{bcbaae0 u0 net.dabz.test.firepaint/.BlitzMaxApp t83 f}
10-21 06:13:57.903: I/ActivityManager(872): Process net.dabz.test.firepaint (pid 24419) has died

Should libfirepaint.so be included in the .apk? I see it in the Firepaint root directory, but unzipping the apk does not show it to be there.


Dabhand(Posted 2015) [#59]
Can you please post the contents of your custom.bmk file, as well as the architecture your building for, and finally, what android device are you trying to run it on?

Also, is their spaces in your paths, I think I read somewhere Brucey stated that spaces are a bit of a no no!

Cheers Tom!

Dabz

EDIT: Just built the fire paint test myself, unzipped the apk file and indeed, libfirepaint.so is right there in "firepaint-debug/lib/armebi"

Dabz


TomToad(Posted 2015) [#60]
addoption android.home "C:\Android"
addoption android.sdk "C:\Android"
addoption android.ndk "C:\android-ndk-r10e"
addoption android.ndkarch "x64"
addoption android.toolchain.version "4.9"
addoption android.platform "12"


Windows 10 Home 64 bit, AMD A8 6410 APU, 4GB memory.
No spaces in any filenames.


TomToad(Posted 2015) [#61]
I don't even have a "firepaint-debug/lib/armebi" directory anywhere in the apk.


Dabhand(Posted 2015) [#62]
mmmmmm bit naughty... Is it in the build folder under libs/armebi?

Dabz


TomToad(Posted 2015) [#63]
No there isn't. However, there is a libfirepaint.debug.so in the root folder of the project, same place as the Firepaint.bmx file. I am now trying a non-debug build to see if that changes anything.


Dabhand(Posted 2015) [#64]
Rightio... Hope it works then it can be replicated/fixed! :)

Dabz


TomToad(Posted 2015) [#65]
Release mode puts libfirepaint.so in the correct place. However, it will not run at all on my Galaxy S3 Jellybean. It will run on AmiDuos with Lollipop, but closes after a few seconds.


Derron(Posted 2015) [#66]
Whats the logcat/crashreport of these crashes?


bye
Ron


TomToad(Posted 2015) [#67]
Sorry, been so long since I've used DDMS, can;t remember how to restrict the logs to only what is relevant to the app. I believe I found the relevant section here. This is from the Samsung Galaxy S3



Dabhand(Posted 2015) [#68]
In Settings > Developer Options, there is a check box called "Don't keep activities" "Destroy every activity as soon as the user leaves it". If the check box is checked, uncheck it and try again.

^the above is taken from a webpage, may help... May not, worth a try!

Dabz


TomToad(Posted 2015) [#69]
It was already unchecked. tried checking it and still didn't work :(


Dabhand(Posted 2015) [#70]
I'm not at me PC tonight, at tuther halfs... Can only delve tomorrow! :(

Dabz


Derron(Posted 2015) [#71]
Do you have your screen orientation fixed (only portrait-mode allowed) ?

Does other apps behave similar?


Dunno about this log entry (ID is of the firepaint-app):
10-21 12:47:08.883: W/ActivityManager(381): Permission Denial: getCurrentUser() from pid=9423, uid=10294 requires android.permission.INTERACT_ACROSS_USERS


Seems your app does not have the permission it wants to use.


bye
Ron


TomToad(Posted 2015) [#72]
Do you have your screen orientation fixed (only portrait-mode allowed) ?

Tried it both ways.

Does other apps behave similar?

No


Dunno about this log entry (ID is of the firepaint-app):
10-21 12:47:08.883: W/ActivityManager(381): Permission Denial: getCurrentUser() from pid=9423, uid=10294 requires android.permission.INTERACT_ACROSS_USERS


Seems your app does not have the permission it wants to use.

Tried adding
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
to the AndroidManifest.xml file. Didn't seem to have any effect.

Also tried Build GUI App on and off.

Tried rebuilding modules, but get an error. Wonder if that has anything to do with my problem?
C:\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar.exe: creating C:/BlitzMaxNG/mod/brl.mod/endianstream.mod/endianstream.debug.android.armeabi.a
C:\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar.exe: unable to rename 'C:/BlitzMaxNG/mod/brl.mod/endianstream.mod/endianstream.debug.android.armeabi.a'; reason: File exists
Build Error: Failed to create archive C:/BlitzMaxNG/mod/brl.mod/endianstream.mod/endianstream.debug.android.armeabi.a
Process complete



Derron(Posted 2015) [#73]
with "other apps" I meant other "bmx-ng-compiled samples".


Regarding the permission: what Android (version) are you running?
I am on 4.2. Most people having this issue are running 4.3 or higher. Seems it has to do with the signature or so?
Did you try a "clean build" (after having issues to get things compiled) - just move that project-xy-folder out of the way (and the hidden .bmx-folder if you want to recompile the sources too).



bye
Ron


TomToad(Posted 2015) [#74]
Haven't tried compiling anything else. just trying to get Firepaint sample to work.

Android version is 4.3 Jellybean. and yes, I completely removed the Firepaint project folder and extracted the source from the FirepaintAndroid.7z again to make sure previous compiles were not affecting it.


Dabhand(Posted 2015) [#75]
What happens if you just do a plain old DrawText app or completely remove the touchhook code?

If I have to guess... I'm now starting to bet theres a memory leak somewhere... I could be wrong like, hope I am really!

EDIT: Have you tried restarting your device then running the app, or even, went into the app manager and force closed ones that are open and then give it a spin?

Dabz


TomToad(Posted 2015) [#76]
I have tried this, TestBNG.bmx
SuperStrict
Import sdl.gl2sdlmax2d
SetGraphicsDriver GL2Max2DDriver() 


Local Width:Int = DesktopWidth()
Local Height:Int = DesktopHeight()

Graphics Width,Height,0

While Not KeyHit(KEY_ESCAPE) And Not KeyHit(KEY_BROWSER_BACK)
	Cls
	DrawText "Hello World!",10,10
	Flip
Wend

But I get an "Unfortunately, TestBNG has stopped" error when trying to run the app.


Dabhand(Posted 2015) [#77]
Right then bonny lad, thats easily fixed...

Copy and paste this:-

Framework sdl.gl2sdlmax2d
Import brl.pngloader
Import brl.random
Import brl.ramstream
Import brl.standardio


Local Width:Int = DesktopWidth()
Local Height:Int = DesktopHeight()

Graphics Width,Height,0

While Not KeyHit(KEY_ESCAPE) And Not KeyHit(KEY_BROWSER_BACK)
	Cls
	DrawText "Hello World!",10,10
	Flip
Wend


Then build it with absolutely no settings set in "Program->Build Options"!

Then have another pop!

Dabz


RustyKristi(Posted 2015) [#78]
Dabhand's example works great as I can confirm it. The END instruction is important though so the proper exit and restart will work.


Dabhand(Posted 2015) [#79]
Yeah, sorry about no End... In a rush to get to work! :D

Dabz


TomToad(Posted 2015) [#80]
Nope, still doesn't work. Beginning to think something went wrong in the install. When I get back from work today, I'll try reinstalling BMX-NG and see if that helps with anything.


Derron(Posted 2015) [#81]
@ the others
What android versions are you running?


Somehow that "permission"-thingy is a bit in question for me.


bye
Ron


Dabhand(Posted 2015) [#82]

What android versions are you running?



4.2.2

I've been reading a bit, and it seems the hop from Android 4.2 to 4.3 did indeed cause a bit grief... I cannot update my device any further, so not testable over here!

Can you post the apk file Tom me auld fruit, then I'll chuck it up on mine to see what the score is.

Cheers

Dabz


Derron(Posted 2015) [#83]
I have 2.3.7, 4.2 - and a cm12-based one here (should be 5.1).

@Brucey
What android "revision" do you use to test ?


bye
Ron


TomToad(Posted 2015) [#84]
Here is the apk. https://drive.google.com/file/d/0B1zQ5dfVU3jbS1FTVzc3dElVdU0/view?usp=docslist_api


Brucey(Posted 2015) [#85]
My device says 5.1.1

According to the SDL wiki, it requires API 12 or greater, so whatever that translates as...

... according to wikipedia, that equates to Android 3.1.


So that, in theory, is your minimum supported version.


Derron(Posted 2015) [#86]
works on my device.

"Hello World" in the top left screen.


Edit:
That "permission" issue is a known one of the Samsung Galaxy S3 devices...

http://stackoverflow.com/questions/20578474/permission-denial-this-requires-android-permission-interact-across-users-full


Edit2: how do you install the apk?

adb install -r TestBNG-debug.apk

?

Also check if it changes something if you move the APK file to "/system/app" as it should gain access to that permission.


bye
Ron


TomToad(Posted 2015) [#87]
Interesting. I haven't tried running the testBNG.apk on my emulator yet. I'll try it when I get home and see how it runs. As for installing I just click on the.apk and the android package manager takes care of installing it. Works for other.apks.


Derron(Posted 2015) [#88]
please have a try using the "command line", as much as I understood some postings on stackoverflow, people had issues with the package manager and the permission (even if I cannot explain it).

So it might be no rocket science but witchcraft, but better tried then not.


bye
Ron


TomToad(Posted 2015) [#89]
The apk works just fine in the emulator running 5.1 Lollipop, but not on my 4.3 Jellybean. I wonder if it has anything to do with being rooted? AmiDuos is rooted, but my Samsung is not. I don't think we should expect people to root phones just to run some apps. Anybody get anything to work on a non-rooted phone, especially 4.3 or above?


Derron(Posted 2015) [#90]
I thought about the "root" too ... all the phones here are "rooted".

If your app would need root access, I think the tools (some su-watchers) will ask you ("bla requires root - admit?").


Did you check what happens if you install in /system/app - or pushing it via command line (adb install -r apkfile.apk)


bye
Ron


Brucey(Posted 2015) [#91]
I'm not rooted here, and everything works fine.


TomToad(Posted 2015) [#92]
Figured out the problem. Samsung's security app is blocking the BMX-ng app, preventing it from launching. Question is why. A simple OpenGL app shouldn't be triggering any security protocols. I have compiled OpenGL apps in Basic4Android without any problems. Seems BMX-NG is doing something weird that is being blocked.


Dabhand(Posted 2015) [#93]
Not rooted either, managed to get a hold of our lasses sons Samsung Galaxy Tab 4 (Android version 4.4.2), TestBNG runs fine on that

So, for me:-

Samsung Galaxy Ace 3 (4.2.2): Works
Samsung Galaxy Tab 4 (4.4.2): Works

Dabz


TomToad(Posted 2015) [#94]
It is a security app called Knox added to some Samsung devices, Galaxy SIII and later S models with os 4.3 or higher, and Note 3 and later with os 4.3 or higher. It prevents third party apps from accessing sensitive data. Apps that would create the most problems would be those that backup and restore app data, and a few root apps. I tried force stopping anything with Knox in it and almost got the app to run. A window pops up for a split second, then the app closes with "Unfortunately, TestBNG has stopped"


Dabhand(Posted 2015) [#95]
Just wondering, but, will read/writing to an SD card trip Knox up?

I've noticed in TestBNG that this is the only permission available, so in retrospect, if Knox doesnt like that, and indeed the app does write something, then it's gonna flip!

This is just guessing as I havent really got a clue what Knox is about, only that it seems like a corporate security feature which I would probably get rid of if I found it on my device!

Dabz


Brucey(Posted 2015) [#96]
Is that the WRITE_EXTERNAL_STORAGE permission in the manifest? You could always try removing it and see if that helps?


RustyKristi(Posted 2015) [#97]
Same here and of course the best simulation or test would be not rooted. :)


Dabhand(Posted 2015) [#98]
So, Knox provides a container for apps to run in, and if they try to venture out of this container it goes belly up... Is that what it does?

Now it reads that all apps, its users and data are all tracked by Knox and it will only allow a user of an app access to that users data. Makes sense... But what I dont understand is, if the TestBNG app is trying to breach this... Wouldnt Knox pop out a bit of toast warning that the app is trying to access area's it shouldnt, in fact, if it is Knox closing the app down, wouldnt there be a hint of it's interference somewhere?

Dabz


Dabhand(Posted 2015) [#99]
Here's another thing... Does Knox play nice with the Android NDK? I've looked at the setup for B4A, and that only mentions installing the SDK!

Will a GLBasic app run on it? As that uses the NDK!

You could also try to chuck a monkey app on it as well for good measure... If the monkey app and b4a app work, fine, but, if both the GLBasic app and bmx-ng app fail... Then we've found our problem, which, isnt really fixable.

Dabz


TomToad(Posted 2015) [#100]
There it's a full version of Knox you can install which will create a container, but there is also a lighter version which merely limits access to apps, similar to Windows UAC. I actually do gett a notification, but I have another app on my phone which occasionally flags the notice, so I didn't connect the notice to this app. Unfortunately, the notice only states"an app has tried to access system and had been blocked" never any notice as to which app is the problem.

Admittedly, several people are upset over the mandatory use of Knox. Fortunately 99.9% of apps still work fine, usually the ones that have problems are those that test for root access. The app that has been flagging the notice is a backup program that backs up sms and contacts. It will also check if you are rooted and back up app data as well, it is during that check it will raise the notice.


TomToad(Posted 2015) [#101]
I have Basic4android and have no problems with anything I compile on it, including opengl apps


Dabhand(Posted 2015) [#102]
Yeah, I know, but that only uses the SDK (Unless I'm wrong), which is Java only isnt it.

GLBasic uses the NDK as well, so if a GLBasic build dies on you, well, it's something!

Dabz


Dabhand(Posted 2015) [#103]

Admittedly, several people are upset over the mandatory use of Knox



I'm not surprised, seems like it's a good excuse to create a walled garden... Yeah, if you have corporate use, then, good idea, for anything else, it just screams "We own your device"

Dabz


TomToad(Posted 2015) [#104]
Anybody know of an app that uses GL Basic that I can install and try out? I have only one game ever give me problems (albino blacksheep's Bloxorz). But it doesn't raise any notice our anything.I simply get a blank screen and nothing else, so I think it doesn't have anything to do with knox


Dabhand(Posted 2015) [#105]
If Knox wraps the app in a container, then obviously, it somehow must identify the contained app to that user, which in turn, the app will be running in a "user" mode, but still needs to be identified by a package name.

Stay with me, cos I dont really know what I'm on about here, but do...

So, if a app has a package name called com.blah.app, then, to identify the user to a package, would it treat that package as e.g. dabz.com.blah.app

Now, our original resource R class would be originally called "com.blah.app.R", but, for this user, it should be "dabz.com.blah.app.R", now if it isnt, BANG... Dead.

So what I'm stating is, this may not be a problem with the SDK if thats how it rolls, as we've seen, but how does this reflect when building NDK based apps... Does stuff get hard coded into an NDK app, thus, borking it because Knox has took over?

Answers on a postcard too... Google! :D

Dabz


Dabhand(Posted 2015) [#106]
Found one (GLBasic apk file):-

https://onedrive.live.com/redir?resid=6791F68A23A2D1C9!6325&authkey=!ADxTdFfiwhB0tQA&ithint=file%2capk

Dabz


TomToad(Posted 2015) [#107]
That app worked just fine. So it it's not GL Basic. I don't know much about glbasic, do all glbasic programs use the NDK? If so, we can rule that out also.


Dabhand(Posted 2015) [#108]
Yep, and it also uses SDL2 as well, which I've just discovered by peeking inside the apk file.

So... officially, I'm out of ideas, out of curiosity, could you try adding the same permissions to the bmx-ng build as the GLBasic one.

Dabz


Brucey(Posted 2015) [#109]
As far as I can tell, neither GLBasic nor Basic4Android use the NDK.

Maybe Knox doesn't allow the loading of user shared objects? (like what the NDK makes)


Dabhand(Posted 2015) [#110]
Honestly Brucey, it does, not all of it, just stuff it needs from the NDK

If you download the android.zip from here: http://www.glbasic.com/platform/v14/

And extract it, you'll see!

I was the one that actually notified Gernot when the NDK was released, as GLBasic, like BMX-NG is entirely C/C++ based.

Dabz


Brucey(Posted 2015) [#111]
I see. Well, GLBasic apps also appear to be signed. Maybe that's something?


Dabhand(Posted 2015) [#112]
Worth a try!

Dabz


Derron(Posted 2015) [#113]
Maybe it is the way of signing things... isnt bmxng signing with a dev-debug-key or so? maybe there is a difference.
Think people mentioned the signing-key as origin of the problem.


bye
Ron


TomToad(Posted 2015) [#114]
Tried adding the permissions from android_res_test, didn't work.
Removed the debug key from the TestBNG-debug.apk and signed with my own key, didn't work.

Scanned the generated source. I don't know much about using the NDK, but I didn't see anything that stood out. I'm at a total loss here.


Dabhand(Posted 2015) [#115]
Its a pig!

Dabz


Brucey(Posted 2015) [#116]
I guess it's just not going to work on some device/software combinations...

Still, there's always Monkey! :-)


Dabhand(Posted 2015) [#117]
Well... I'm back home, so... One will install Knox on my dev android device for a play! :D

EDIT: Cannot get Knox for my device! :(

Dabz


Dabhand(Posted 2015) [#118]
Just par chased a galaxy S4 off Ebay so I can have a little dig about... This little hiccup has me intrigued! :D

Poor little sod is gonna get the kitchen sink chucked at it! :D

Dabz


Dabhand(Posted 2015) [#119]
Ah:-

Building firepaint
gcc not found at 'C:\android-ndk-x64/toolchains/x86_64-4.9/prebuilt/windows-x86_64/bin/x86_64-gcc.exe'
Process complete


Path should be:-

C:\android-ndk-x64/toolchains/x86_64-4.9/prebuilt/windows-x86_64/bin/x86_64-linux-android-gcc.exe

Platform: Android
Architecture: x64

Dabz


Dabhand(Posted 2015) [#120]
Galaxy S4 is here!

Naughty Knox preinstalled!

Tried to run firepaint demo!

Plan for tonight!



Dabz


Dabhand(Posted 2015) [#121]
Right, as it goes, the app starts well, loads the .so file, then we get a fatal signal (6), then the whole lot keels over and dies!

I'm pretty much getting the feeling its not Knox now, just a dodgy pointer, dodgy string conversion, dodgy dodgy something!

My heads a mess, and notepad++ isnt half creaking under the load due to me trying to figure out how all this guff strings together! :D

Brucey, you must have a head the size of Jupiter to keep track of all this mind! :D ;)

Dabz


Dabhand(Posted 2015) [#122]
Not sure if this is a silly question or not... But can anyone tell me how/where this bloody thing is defined:-

int __bb_brl_blitz_blitz();


When I say defined, I mean, where does blitz.bmx.debug.android.armeabi.c get it from?

Dabz


Brucey(Posted 2015) [#123]
It's at the bottom of the file.
It initialises global variables, local types, and executes the "module local" scoped code.
But that's likely not where your problem lies. Do you have a backtrace?

How much was your S4?


Dabhand(Posted 2015) [#124]

It's at the bottom of the file.



Yeah, I found that... But if you edit it, delete the .o file, the .c file refreshes and the edit is lost when the .o file is rebuilt when you rebuild the project, so I'm wondering where it comes from, as it's not in blitz.bmx

I'm just trying to work out how all this flows see before moving on.

I've been calling *#9900# for assistance, but SysDump isnt offering much in respect of whats going on, loads the firepaint lib, then dies.

This, £30, no charger, cables or anything, little scuff on a corner... Still a bargain when it comes to making a man bald! :D

Dabz


Brucey(Posted 2015) [#125]
so I'm wondering where it comes from

It's generated by bcc :-)
Every imported file has a section like this which gets run once when the instance is loaded.

I'd offer some assistance, but I can't really do anything from here with the information at hand.


Brucey(Posted 2015) [#126]
Did you get the I9500 or the I9505 ? (both S4's but appear to have completely different CPU/GPU)


Dabhand(Posted 2015) [#127]
Opps, should of said... It's the S4 mini (GT-19195), Qualcomm Snapdragon 400, armv7 based.

GLBasic uses armv6 (Going off investigations), and that androtest.apk runs fine.

DumpState: https://onedrive.live.com/redir?resid=6791F68A23A2D1C9!6327&authkey=!AJy2eP91GI4aZFo&ithint=file%2clog

avcmsg: https://onedrive.live.com/redir?resid=6791F68A23A2D1C9!6326&authkey=!ALld5pb-jwPRXQY&ithint=file%2clog

Sorry I was a bit late posting this... Tucked up in the scratcher when I was waffling on before! :D

Dabz


Brucey(Posted 2015) [#128]
Line 11339 of the dumpstate appears to be the point of failure :
libc    : bionic/libstdc++/src/pure_virtual.cpp:6: void __cxa_pure_virtual(): assertion "!"Pure virtual function called. Are you calling virtual methods from a destructor?"" failed


I would try running the app with gdb : http://developer.android.com/ndk/guides/ndk-gdb.html
And if gdb can catch the fault, we may be able to get a backtrace out of it - which may help to narrow down the actual point in the app it all falls apart.

Maybe I need to get an S4...


Dabhand(Posted 2015) [#129]
I'm back for another look tonight! I'll let you know how I get on!

Dabz


Pingus(Posted 2015) [#130]
I do not had the time yet to check the Android compile, it is a bit complicated to me, but I had a look at Brucey's NG version which looks very promising. At least I am able to run it and compilet samples for Window :)
'If' it works also for Android... I have the feeling that something is happening here.
Maybe I'm wrong but I wonder if people here are aware enough about that ?


Dabhand(Posted 2015) [#131]

Maybe I'm wrong but I wonder if people here are aware enough about that ?



Well... at the minute, it's still a little shakey, but coming along... And yeah, it's all a bit monstrous! :)

Managing to get gdbserver sorta grafting... lol, massive learning curve this... It's a weird life... An hour ago I was trudging around a building site up to my eyes in clarts, next up, sitting at a desk hoping to see the twinkle of an attached pid! :D

Got the twinkle, need to tinkle! ;) <----- what does that even mean!?!

Dabz


Brucey(Posted 2015) [#132]
Hallo, could you give this firepaint apk a test for me please ?

http://brucey.net/programming/blitz/bmx_ng/demos/firepaint-debug.3.09_test.apk.zip

It's build for armeabiv5 so should work on most ARM devices.

I've tested it on a Nexus 7 and Galaxy S4, and they both work.
I had to make some changes to the build system to get it running on the Samsung, which may, or may not, have also fixed the issues you were seeing on your devices too.
If it doesn't, then back to the drawing board - but at least it is working on these two devices ;-)


@pingus
The most complicated part is getting the directories set up in custom.bmk (there are notes in the custom.bmk that ships with the bmk source).
Once that part is correct, a simple graphics app should *just work*. (like drawtext "hello world").
I will try to put together some notes about how you may want to set up your app to work on mobile - like what modules you will need, how to enable sound, program structure, etc.


Dabhand(Posted 2015) [#133]
Will test tomorrow me auld mucker... Fingers crossed eh! :)

Dabz


Pingus(Posted 2015) [#134]
Thanks Brucey.
I have to buy a tablet for testing, currently having only a intel-base tablet so I guess it can not work. Would you recommend any tablet with a ARM processor or must it be a Nexus 7 ?


Brucey(Posted 2015) [#135]
We can build for x86 and x64 Android targets too - I only have two ARMs though (haw haw).
So, no, you shouldn't need to buy another device.

Current Android targets are : x86, x64, armeabi (v5), armeabiv7a, arm64v8a
(I haven't included MIPS because I've no knowledge of that architecture. There's no reason it shouldn't work either, were I to enable support for it)

Dabz says he has an x64 device, which he should now be able to build against (since I've fixed some tool path issues) - then we'll know if the Intel support is also working.


TomToad(Posted 2015) [#136]
Nope, still being blocked by the S3. Is your S4 at 4.3 or above? From what I am reading, that is when problems started happening on the Galaxys.


Brucey(Posted 2015) [#137]
The S4 came with 5.01, unfortunately. It has Knox installed, so I doubt there are any problems with that.


Derron(Posted 2015) [#138]
Like "hinted" in some earlier posts of this thread: it might have something to do with the permission (not granted to the app) - and this starts with "4.3" (and might be invalid on 5.x+).

You (Brucey) might consider having multiple recovery images - so you could switch android versions without much trouble. There should be some 4.3-images on the www.

Nonetheless there is no guarantee for it to behave the same than the s3 then (but I assume so).


bye
Ron


Dabhand(Posted 2015) [#139]
I still have to run it through my S4 later on today, it has 4.3 installed from a factory reset, I'll post as soon as I can.

Dabz


Dabhand(Posted 2015) [#140]
Well... One S3 report in...

http://socoder.net/?topic=5070&seenpost=49869#49869

Seems it's working on GFk's S3 (4.3)

Dabz


Derron(Posted 2015) [#141]
@dabhand
Ask "rockford" for a log (adb logcat - etc.).


bye
Ron


Dabhand(Posted 2015) [#142]
Asked, but he's off to work, but he's put up his testing device name

Steve is trying to get the dump state for his as we speak.

Dabz


TomToad(Posted 2015) [#143]
Is perhaps GFKs phone rooted? You can get away with a lot of things on a rooted phone that you can't on a non rooted phone.


TomToad(Posted 2015) [#144]
BtW the version of Knox on my phone is 3.0. Don't know if that makes a difference.


Dabhand(Posted 2015) [#145]
Bugger... It's rooted! Good call TT

Dabz


Derron(Posted 2015) [#146]
With root you get that "permission" which dabhand's log contained something about.

bye
Ron


Brucey(Posted 2015) [#147]
Well, I've enabled Knox on mine, and it appears to be a completely separate section on the phone. The app doesn't even show up inside the Knox section.
In the Personal section, the app is there, and it runs as expected. So I doubt Knox has anything to do with it.


Brucey(Posted 2015) [#148]
Maybe American Samsungs are different to European Samsungs?

What processor onboard your S3, Mr Toad?


Dabhand(Posted 2015) [#149]
On my s4 there is no Knox or personal modes, that I saw... And I looked too, but only found anything related to it under applications->running!

So presumed it's in Knox mode constantly (For 4.3 at least)

Dabz


TomToad(Posted 2015) [#150]
There are 2 parts to Knox. There is the part you can install from Samsung which creates a protected partition on the phone. There is another part which is part of the OS which prevents apps from accessing system areas without prior approval from Samsung. It is that second part which it's compulsory on Samsung galaxies. There is no icon for it, you can find it under manage application, all installed apps as a bunch of com.sec.knox services.


Derron(Posted 2015) [#151]
Do the ones, who get it running on their S3/S4 on android 4.3 get these "permission"-debug-entry in the logcat too?

10-21 12:47:08.883: W/ActivityManager(381): Permission Denial: getCurrentUser() from pid=9423, uid=10294 requires android.permission.INTERACT_ACROSS_USERS


if yes - and it still does work, then we know that this is not an issue linked to the problem.



bye
Ron


TomToad(Posted 2015) [#152]
Just noticed, the part of Knox that controls system access is officially called Security Enhancements for android.maybe that can help on researching a solution.


Dabhand(Posted 2015) [#153]
The above apk doesnt work on my S4, here's the logcat:-

https://onedrive.live.com/redir?resid=6791F68A23A2D1C9!6328&authkey=!APyw4R6bslAffaY&ithint=file%2ctxt

http://94.76.204.78/logcat/logcat1108151513.txt

Pretty much the same as the dumpstate I put up before!

Dabz


Derron(Posted 2015) [#154]
@onedrive-link

"the directory is empty".

pastebin.com etc should do too.


@dabhand
Did you have that issue on a "not 4.3" android of your device too? Just to narrow down things...

Maybe that is the reason of that "force close" thingy.


bye
Ron


Dabhand(Posted 2015) [#155]
http://94.76.204.78/logcat/logcat1108151513.txt

Havent mucked on with changing the firmware I'm afraid if thats what you mean, but, just installed in on my Galaxy Ace 3 (4.2) and thats fine!

I'll have to look into flashing different versions... Any good guides on it before I head out for a look!

Dabz


Derron(Posted 2015) [#156]
think you will find many tuts on xda-developers.com for your device. Keep in mind that there are devices which "mark" (they kill a fuse) if you flash custom firmware (-> potential warranty loss). Think "samsung" was one of the manufactorers.

So maybe it is better to have one with "4.3 rooted" and having it "working" - which then just has to get "unrooted".


Edit: I asked this before, and I doubt anyone tried it:

Install the app on the system partition (via "adb install" as told in a previous post of mine: post #86)


bye
Ron


Dabhand(Posted 2015) [#157]
Oh shite... My android version on the S4 is 4.4.2, which is the same version as that Galaxy Tab I tested on... Which worked!

Apologises for that!

Pants though, but, good in a way, as it shows it is indeed a S[x] problem (Up until 5.01 that we know of)

Dabz


Derron(Posted 2015) [#158]
see my prior post: check if installing it on the system partition changes things...

... if it faults on 4.4.2 too - this gets rid of "downgrade your firmware" issues :-)


Edit: another potential flaw might be the added multi-user-management in 4.3+. Maybe we need a newer "SDK" so the resulting app is "aware" of it.

Also try if changing the app in "superSu" to be run as system (or "user").


Edit2: according to this page
http://cholla.mmto.org/computers/android/topo_break.html

the permission-issue might be coming from a absolutely different required permission (in this case "READ_EXTERNAL_STORAGE" - because his app wanted to read a file from the sd-card). So if this is true, then the needed permission might be something else...


bye
Ron


Dabhand(Posted 2015) [#159]
Done:-

adb install firepaint.debug-debug.apk

and

adb push firepaint.debug-debug.apk /sdcard/0/firepaint.debug-debug.apk <---- then install via MyFiles

If thats what you mean, then yes, tried them matey!

Dabz


Brucey(Posted 2015) [#160]
So I need to get an S3 too?


Dabhand(Posted 2015) [#161]
And for good measure:-

adb push firepaint-debug.apk /sdcard/0/firepaint-debug.apk

Which closes a lot cleaner then the one further up... As in, opens, fails, closes!

Where the one prior opens, fails, and then hangs around like a bad smell!

Dabz


Dabhand(Posted 2015) [#162]
So I need to get an S3 too?

Or you could downgrade your S4 to 4.4.2 (Issues there... Could be the same as the S3's)

Dabz


Derron(Posted 2015) [#163]
nope, what you have done is a "as user"-install.

If you install on /system/app (maybe it even needs a "chown" to change the user/group according to other apps in that directory)) you will get a "system install".

This might be even doable with other tools (titanium backup, SuperSU ...). The principle is "convert to system app".


another tut:
http://android.stackexchange.com/questions/27/how-do-i-properly-install-a-system-app-given-its-apk

Edit: edited previous post too ("other permissions")

bye
Ron


Dabhand(Posted 2015) [#164]
Ah, right, get you!

Dabz


degac(Posted 2015) [#165]
Just tested the .apk on my ZTE Nubia Z7 mini: it works without problems


Dabhand(Posted 2015) [#166]
Steve has just mailed me his dumpstate file:-

http://94.76.204.78/logcat/dumpState_201511081257.log

Different errors to mine, and probably Bruceys!

Derron, all roads there lead to rooting phone as far as I can make out, which, isnt what we're after is it, and we know it works on a rooted S3 (4.3)

Honestly, Android is proper messy, I never realized as much until now, it's borderline disgusting if you ask me!

Dabz


Derron(Posted 2015) [#167]
Hmm that log contained "ioremap" .... which made me think about "whats different" in firepaint...
... it includes media assets.

Might be an issue source too ... might need an added "READ_EXTERNAL_STORAGE" as required permission (if the files are "extracted" first...)?
Imho I do not think so, but just to have talked about it :-).


If other blitz-samples work: firepaint uses "GCMemAlloced()" ... which might need certain "permissions" too on android?

But as the APK did not request "root" on my devices, I assume I am just talking garbage.


Nonetheless:

Steve's log contains this:
11-08 12:56:54.829   802   802 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: 
Cannot load library: link_image[1963]:
94 could not load needed library 'libstlport_shared.so' for 'libfirepaint.so' 
(load_library[1105]: Library 'libstlport_shared.so' not found)


Which is the reason for the app crashing on his phone.
That "libstlport" is what brucey added in the last "build".


Edit: added "GCMemAlloced()"-sentence. @Dab: if other apps (blitzmax-ng-compiled) run on your device: trim down the code.

bye
Ron


Dabhand(Posted 2015) [#168]
Nah, none do... And I've updated to the newest bmk and building and installing:-

Framework sdl.gl2sdlmax2d

Import brl.random
Import brl.ramstream
Import brl.standardio

Local Width:Int = DesktopWidth()
Local Height:Int = DesktopHeight()

Graphics Width,Height,0

While Not KeyHit(KEY_ESCAPE) And Not KeyHit(KEY_BROWSER_BACK)
	Cls
	DrawText "Hello World!",10,10
	Flip
Wend 


:/ Whatever is wrong, well... Its a bloody nightmare!!!

Dabz


Derron(Posted 2015) [#169]
There should be no need to import these 3 modules (random and ramstream are not used, standardio too - I think).


You might also check if a simple

SuperStrict
framework brl.standardio

print "hello world"


gets the same "permission" entry in your logcat - or some "java errors".
(just "grep" - or "copy/paste-CTRL+F" for your app binary name).


Intention is to narrow down, what part of the "process" creates the problem: either bmx-ng or some of the modules...

bye
Ron


Dabhand(Posted 2015) [#170]
Now my Galaxy Ace 3 isnt running bmx-ng apps! :/

I'm going to have to take a little step back here and regroup! :D

Dabz


Brucey(Posted 2015) [#171]
You might also check if a simple...

You will need SDL. It won't (shouldn't) work without it.

Android is proper messy

Isn't it! :-)


Dabhand(Posted 2015) [#172]
Don't know what I've done... But, erm, yeah... Totally wrecked something... Not even apps built from the old windows bmx-ng I fudged is working! :D

Screen goes black, 10 seconds later it loses focus and returns to the OS!!!

Bloody hell... Think it's time for pizza!

Dabz


Brucey(Posted 2015) [#173]
You've been fiddling a lot recently. Maybe you've done something to your SDK/NDK stuff ?

Also, make sure you full-rebuild the modules if you are changing things too much (like swapping out new bmk's or the likes).
bmk makemods -a -l android -g armeabi brl
bmk makemods -a -l android -g armeabi pub
bmk makemods -a -l android -g armeabi sdl

.. change -g option to whatever you are building for... (run bmk with no params for usage text and list of valid options)

Take a break :-)


Brucey(Posted 2015) [#174]
I've just pushed another bmk tweak which should force loading of required libs. (well, so the code thinks).

I've also re-uploaded the apk with the changes. (may allow Steve's device to start it now).


therevills(Posted 2015) [#175]
I'm still getting the KNOX error on my work's S3 using this APK:

http://brucey.net/programming/blitz/bmx_ng/demos/firepaint-debug.3.09_test.apk.zip

"Security information"

An application attempted to access system on your device without authorisation. This attempt has been blocked. Deleting applications obtained from unauthorised sources may improve security."

Seems to be a very common issue even with Xamarin:

https://forums.xamarin.com/discussion/9210/samsung-s4-permissions-problem


Brucey(Posted 2015) [#176]
Yes, if I knew what it actually meant, I'd be able to figure out what needs changing ;-)

The apk is just a straight debug build. I assume it gets some basic debug signing as part of its packaging.
No idea why it thinks the app is trying to access the system either, unless SDL is doing something...

I'll see if I can get my hands on an S3 next...


therevills(Posted 2015) [#177]
How is the APK signed? Maybe try a release signed APK?


Dabhand(Posted 2015) [#178]
Seems like the enterprise editions of S3's are a bit more mouthy then the average joe ones!

Why in the name of all things do they not have warning messages in personal mode?

Knobs!!!

Dabz


Brucey(Posted 2015) [#179]
I thought debug signing was automagic?


TomToad(Posted 2015) [#180]
You need to sign the .apk with %USERPROFILE%/.android/debug.keystore when creating a debug build.
When I looked at the contents of the .apk, I thought I saw it had been signed. Already tried a release signature, but that didn't work either.

Edit: made sure it was signed with a proper debug key, still no go. We can rule out signing as a possible problem.


Dabhand(Posted 2015) [#181]
I think one problem is, with Knox, even though you set permissions in the manifest, it takes no bloody notice of that if your app touches something it thinks you shouldn't anyway... I read a thread last night in bed about problems with Knox, app and camera... Someone had all the right permissions, but it would only graft after a camera module was ripped out of the library!

Stupid bloody thing!

Dabz


therevills(Posted 2015) [#182]
I'm just throwing ideas around here :)

How about creating a small "pure" SDL Android APK and testing that?


Brucey(Posted 2015) [#183]
Okay. So I have here an S3 :-)

I've factory reset it. It has 4.3 on.

Running the firepaint sample results in.... a running firepaint sample! Albeit with a red background - this is a known issue with the default RGB settings that SDL uses and is easily tweaked.

So there we are. It's running fine here on an S3.

What do I need to enable to make it not run?


Derron(Posted 2015) [#184]
Do you have that "knox" installed?

other things which might be of interest:
- sdcard inserted - which one is "sdcard0" - an internal one, an external one
- extra software installed? (some "watchers" or greenify-tools or so)

Now to the more interesting part:
- the s3 user with "problems" should create a backup of his installation (via cwm this is not problematic)
- afterwards he should do a firmware reset too - and check if it works then

both (brucey and the "faulty s3"-owner) should provide the firmware they used when running the app.


@Brucey
Hope you got it for testing purposes and did not have to pay something when finally the bug might be something "not-s3-specific".


bye
Ron


Dabhand(Posted 2015) [#185]
I'll have a look at tonight again... Fingers crossed I've got a bit of an easy shift today so I won't be like a broken pair of braces when I park my arse in front of the PC!

Dabz


therevills(Posted 2015) [#186]
So there we are. It's running fine here on an S3.


Cool! With the same APK?

afterwards he should do a firmware reset too - and check if it works then


Not going to happen with the work phone ;)

@Brucey - could you create a simple hello world APK both with NG and in pure C using SDL?


Brucey(Posted 2015) [#187]
Cool! With the same APK?

Yes, but I was really hoping it wouldn't work, as it would have made it easier to target the problem!

could you create a simple hello world APK both with NG and in pure C using SDL?

I shall look into it :-)


TomToad(Posted 2015) [#188]
@Brucey.

Look at settings under "About Device." Scroll to "SE for Android status", might be labeled "SELinux Status". See if it is enabled and what version.

Mine: Status = enforcing
Version = SEPF_SGH-T999L_4.3_0029

Also, Settings -> Security -> Change Security Level
Mine: Normal: blocks explicit threats
Cannot change.

Apparently there is a version of Knox in which this setting can be disabled. Maybe carrier specific?


Pingus(Posted 2015) [#189]
Trying to compile for Android, X86, I first get errors about missing gcc:

c:/android-ndk-r10e/toolchains/x86-4.9/prebuilt/windows/bin/x86-gcc.exe


At this place there are indeed a bunch of exe files but none named like that. So I renamed that one : "i686-linux-android-gcc.exe" into "x86-gcc.exe"
Maybe first mistake ?

Similar message about a g++

Renamed : "i686-linux-android-g++.exe" into "x86-g++.exe"

Now the compile starts but I get

/BlitzMax/mod/brl.mod/glgraphics.mod/glgraphics.linux.c:3:19: fatal error: GL/gl.h: No such file or directory


Any idea about where I can find this GL/gl.h ?

Why everything is called "linux" something in a windows directory ?


Dabhand(Posted 2015) [#190]
Mine for my S4:-

Status = Enforcing
Version = SEPF_GT-19195_4.4.2_0042

And, I cannot change security level on mine either... In fact, the option isnt even there!

@Pingus

Have you downloaded the newest BMK from git? Brucey mentioned he tidied it up, but I've never tested it.

Dabz


therevills(Posted 2015) [#191]
The work's S3:

Status = enforcing
Version = SEPF_GT-I9305T_4.3_0029

Settings -> Security -> Change Security Level - > Two options: High and Normal
It is set to Normal: blocks explicit threats

I can change it to High... if that helps.


therevills(Posted 2015) [#192]
could you create a simple hello world APK both with NG and in pure C using SDL?

I shall look into it :-)


Any progress on this?