Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
02-23-2016, 02:54 AM
(This post was last modified: 02-23-2016, 02:57 AM by Schwertspize.)
That's not how android works. Android doesn't allow anything at all by default (which is, if you are no app). Apps can request permissions to do something, like the obvious Internet permission which is, to bind sockets. Btw, because it's Linux, noone else than root can bind low ports, security matters (dont quote me on that, this feature is in discussion on removing it entirely and replacing it by some other, eg it makes sure that not any arbitrary user can start an ssh server on port 22, you are sure that if the server is running on port 22 the system owner has done it and Noone else
I got a few other notes: if running it is via the app, I get the confirmation that the binary is starting, but It freezes instantly. I have tracked down the problem that it's most likely opening the log, but I am not entirely sure. Basically it's not denied o open it it's not allowed, but it's frozen as if it was waiting for something (maybe that has something to do with the new Android m permissions, but I am not sure. I will set the build number and target number to 22 in which case it's running without the new permission concept
Edit: if binding the port is still a problem I will look at it later, my main goal now is getting log output :p)
Posts: 8
Threads: 1
Joined: Feb 2016
Thanks: 0
Given 1 thank(s) in 1 post(s)
02-23-2016, 04:12 AM
(This post was last modified: 02-23-2016, 04:15 AM by Barracuda72.)
(02-23-2016, 02:54 AM)Schwertspize Wrote: That's not how android works. Android doesn't allow anything at all by default (which is, if you are no app). I can be wrong here, I'm not an Andriod expert - but is there really any limitations (besides usual Linux) for *native* processes? I have three Android devices (4.2 and two 4.4), on all of them it's totally OK to run Cuberite from terminal under some random unpriveleged user - probably the user that belongs to Terminal application, obviously it don't have "Internet" permission (neither is ADB "shell" user). So, if you are running under some another application UID, it should be also fine. But maybe something were changed in 5.x/6.x Android, I don't know. Or maybe I just don't know how Android permission system really works.
Can you post an APK here to test?
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
02-23-2016, 04:32 AM
(This post was last modified: 02-23-2016, 04:33 AM by Schwertspize.)
Hehe, if only I had an apk. I could add an apk, but 1. It assumes that you got patched server stuff already in the right locations, 2. It's hardcoded, 3. You would need logcat too, for reasonable output and root, because you would have to place everything on the right location. This is a very pre-alpha state. (partially logging goes into the text view but mostly it's just sout (system.out) because it's easy. You can just say sout and the stuff gets logged to logcat without struggling with threads, the ui thread and anr (application not responding)).
As far as I know, android applys permissions to users (mine is u0_a98 where u0 means user 0 (android has users, that's the first user), a means app I think and 98 is some kind of counter) and everything including native is running under that user. But btw I am not running cuberite via the NDK as native, I am running the binary via a ProcessBuilder. That allows me to run it without sticking to the compilation of the apk although It might only run on armhf devices. Other then that, it makes the whole process much easier.
Edit: to be precise, the shell user you are as adb shell has no rights at all except root if you are in the manufacturing mode. But that's another story
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
Success!!!
I successfully had it starting with my app, unfortunately it required root. As I looked around a bit, this may be related to how the binary is compiled. For now I will focus on a simple Downloader, keep that static prebuilt binary and then let you guys test the first version.
Note, that it doesn't run good if it requires root
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
finally: i think i am now getting somewhere... today spent my time on starting the download, its all a bit of a mess, and we got github: https://github.com/cuberite/android. As the description says, this is not designed to be used, this is just a documentation of how far i am. create issues, but dont touch code, please (or dont write pr, as it changes too often, write an issue of what you want to have changed)
what i didnt touch:
- root needed
- text input
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
03-01-2016, 05:19 AM
(This post was last modified: 03-01-2016, 07:35 AM by Schwertspize.)
what i did confirm: the need for root was just related to how the binary is compiled. after choosing some of the other armhf builds, they worked like a charm (i even didnt have to patch them with patchelf...) (more updates on this post later)
edit 1: basically its what you can see from my (rather long) commit message:
shell is now changeable on runtime. root isn't required by app (1). inputLine almost finished. looked a bit at notifications
(1): root isn't required by the app, but sometimes the executable needs it, I assume its needed because of how the executable was compiled. probably needs further investigation.
edit 2: so... no root and no need of patching binaries. Hooray! (so i need basically just the libraries from the build sysytem in a seperated archive, seperated, because they dont change from one build to another. also binary and the other Server dir should be seperated)
Edit 3:
I thought about it again. We actually have 3 parts. 1. A one time download of the Server directory (or, if something changes like the crafting, we have to think about it). A nearly onetime download of the libraries needed. Only if they are updated (and used on the build server) through repositories they get updated. A many-time download of only the cuberite binary initiated by the user.
We got
- 8 libraries (maybe two more needed) with the overall size of 2.7MB uncompressed
- binary (around 8.1MB uncompressed normal mode, around 70MB debug mode (uncompressed))
- around 5MB uncompressed Server directory (without world, the world can reach gigs of data if it's a rather large one, same as on pc)
That's basically what we need to download (I would say to not enable debug binaries by default but by setting)
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
03-05-2016, 09:15 PM
(This post was last modified: 03-06-2016, 04:03 AM by Schwertspize.)
at last: another update.
now thats the first usable version, with a basic installer. it asks for the executable file and one file in the library directory (i couldnt just ask for a directory) which should contain the libs.
binary: use any binary of the raspi buildserver
libraries: extract the archive i packed in the attachments into one folder. it the should contain these files "ld-linux-armhf.so.3 libc.so.6 libdl.so.2 libgcc_s.so.1 libm.so.6 libpthread.so.0 librt.so.1 libstdc++.so.6"
after installing and running the app, choose the executable and one of the libs in that directory (it only gets the parent). wait for the process to finish and push starrt button.
Happy enjoying my first version
libs: https://qraut.alkaid.uberspace.de/cuberite-libs.tar.gz (attachment doesnt allow 1.3mb )
apk (note that this is a debug apk so uninstall it before installing one of the official ones): https://qraut.alkaid.uberspace.de/cuberite-app.apk (1.4MB)
Note: the app just copies everything in the same directory as the selected library is into its private library path, so put the libs in a separate dir
Second note: never push the "update cuberite" button (it just downloads unnecessary stuff, I think a latest raspi build and doesn't do anything with it, that's unfinished yet and the select stuff installer was just a quick sketch (I will use parts of it)
Third note: I know a logo is missing
Forth note: put the server directory by default to /sdcard/cuberite but this is changeable in the settings
Next note: appearantly j got a problem with the default settings. I will soon give you a fixed version.
Tested and not working on lg g4 today
Posts: 4
Threads: 1
Joined: Mar 2016
Thanks: 0
Given 0 thank(s) in 0 post(s)
03-31-2016, 09:58 PM
So good~~!
But not work on my phone .
Plz continue, l really looking forward to this
(Sorry for my bad english
Posts: 721
Threads: 77
Joined: Apr 2014
Thanks: 113
Given 130 thank(s) in 91 post(s)
03-31-2016, 10:01 PM
(This post was last modified: 03-31-2016, 10:36 PM by LogicParrot.)
Bearbin, guenstig_werben, and I are trying to get this to work without the external libraries by compiling it statically. I am currently awaiting for the ARM build to finish. You can see our conversation here:
1. https://botbot.me/freenode/cuberite/2016-03-30/
2. https://botbot.me/freenode/cuberite/2016-03-31/
You can join the conversation via IRC here:
https://kiwiirc.com/client/irc.freenode.net/#cuberite
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 thank(s) in 16 post(s)
@ supaperbag could you post me a screenshot or something of the log of tell me what's wrong? And besides, the phone model would be great
|