Jump to content

Got it running on Nexus 7


Recommended Posts

EDIT: GemRB from sourceforge runs dandy on Android now, please see the last page of this thread (or page 5 at least.) Much of what I write in this post no longer applies, including what I say about the install paths. The major problem was that the config file was not being read. That has now been fixed.







after some trial and error, I have gemrb running on my Android tablet, a Google/Asus Nexus 7 (first generation.) I'm posting this because a lot of people seem to have trouble getting gemrb to run on android. Please note that what I describe here might not work on other Android devices.


My device runs Android 5.


Version 0.8.3 from sourceforge does not install ("There was a problem while parsing the package.")

Version 0.8.0 does install.


I copied over the BG2 installation from my PC, which had the fixpack (version 9) and a few other things, such as general biffing (?), installed. I did not install the widescreen mod yet, but the game runs fine in 640x480, 800x600 and 1024x768 on this device regardless (the native screen size is 1200x800.) Smaller resolutions get zoomed on this device until they fill the screen in at least one direction.


I had to jump through a number of hoops. After installing gemrb 0.8.0, I immediately noticed that it had put data into




This is also where it seems to put the gemrb.log when you don't have games installed. However, the real stuff is going into




This is also where it puts the config file after install. Not obvious. But here's the major thing:


It would not start the game as long as the bg2 folder was in the former location, even though I set the game paths correctly in the config. For some reason, I had to move the bg2 folder to the latter location in oreder to get the game to start, and I had to use the path as I wrote it above (my device provides a shortcut whereas "/storage/emulated/0" is the same as "/sdcard" - some kind of symlink? - but it would only start the game after I put the long version of the path into the config.) Relative paths such as ./bg2 did not work.


So, /sdcard/gemrb/bg2 did not work in my case, even though there is a bg1 folder already in there. My full game path is:




The cache path, however, had to be /sdcard/gemrb/bg2/cache, for some reason, or again, the game wouldn't start.


I didn't turn on any weird options in the config. All original resolutions work on this device without the necessity to install the widescreen mod (this might not be the case on phones or whatever, YMMV.) The only noteworthy things I turned on were "Skip intro videos" (it would crash after the WOTC video otherwise) and especially "Touch Scroll Areas." This latter one seems to prevent the screen from scrolling randomly, which it did before, and allows for proper use of the bottom row of controls.


Sound is working fine, a few occasional crackles but that's not too bad.


Saving and loading games works fine.


Another thing I installed was an app that can switch the tablet to "immersive mode." This hides the navigation bar, which otherwise consumes a lot of screen space. Consequently, the game appears much larger. (Your tablet does not need to be "rooted" for this, read the description of these apps before you download them from the google play store.)


Well. After all this, I've got playable Baldur's Gate 2 on my Nexus! Awesome.


Touch controls:


I find scrolling the screen works easiest if you just double-tap so it will center on the character's new position. The "scroll gutter" works too. The various buttons are easier to hit with your finger at a low resolution - 1024x768 made them ridiculously small. The main problem is selecting dialogue options. I've sent Minsc home two times in a row because the lines of dialogue are so difficult to hit with certainty. Numbered softkeys along the side of the game UI might help here. In character creation, some UI elements are very hard to hit as well, but this can be done on the PC of course.


One helpful thing is that the Nexus has a developer feature that lets you triple-tap the screen in order to zoom in on a point. This makes some things easier.


So far, the only severe bug I found is that sleeping in the dungeon crashes the game. Ow. It might just work in taverns, though.


I'll update this thread as I discover new things with gemrb on android.

Link to comment

First success: Managed to build, install and run gemrb


I really just had to follow the readme file, although I did have to change one line in the script. Unfortunately uninstalling the old version wiped my bg2 folder, so I'm having to copy that over again.


But yeah, seems like I can build gemrb for android. Hurrah. Having a Linux PC might help.


Edit: It starts loading the game, but crashes while resources are loaded, not always in the same spot though. Perhaps it's because I built it for Android 6, I'm going to rebuild it for 5.1.1 which I have.


I figured out why I had those path problems earlier, a cache folder from my PC installation might have been the culprit. After deleting cache/ I can run the game from /sdcard/gemrb/bg2.

Link to comment

Cool! Yes, if the cache dir was not empty, we would error out in order not to delete anything sensitive.

What did you have to change in the script, besides perhaps the api level?


btw, do you know if we need to do anything about:


to me it seems installing via apk should take care of things, the other half being installing the game into a sensible spot (but that's up to the user).

Link to comment

@lynx: I only had to change the API level, actually. Compiling and packing definitely worked, now I just have to build a version that doesn't crash. I might do a git checkout since I'm currently only working with a sourceforge tarball. I saw there were some commits there.


Regarding the external SD thing, the Nexus 7 simpy doesn't have such a thing. It has no card reader slot. I could try and get a USB on the go cable and a USB card reader at some later point and see what that does.

Link to comment

I'm not sure if the API level in prep_env.sh even needs to be changed, tbh. I assume the ndk_build simply takes the desired API level from the various AndroidManifest.xml files (android:minSdkVersion.) So I'm not sure what the line in prep_env actually does. I'm new to android programming.


I figured out that the android:minSdkVersion and android:targetSdkVersion set the desired API level compatibility for the app. On my tablet, I have an app called Manifest Viewer that lets me see the manifest of any installed app. This seems to prove that setting the min API level in the manifests does seem to work.


My compiled still crashes though, even though I now set minSdkVersion to 22 everywhere (Android 5.1.1, which is what I have.) There's progress though: It now always crashes in the same place, during [Core]: Loading Fonts, when it loaded font NORMAL for Res... and then it crashes.

Link to comment

So you don't see "[ResourceManager]: Searching for 'FLOATTXT'..." (the next font to be loaded)? It's all done in a loop, so this is a bit odd. The code is around ine 1189 of gemrb/core/Interface.cpp and for bg2, the table listing them is in gemrb/unhardcoded/bg2/fonts.2da .

Link to comment

Perhaps I didn't completely uninstall the data from gemrb 0.8.0 before I installed this one. I'll try and make sure of that.


The only other reason for the crash I can see is that the engine tries to do something else roughly at the same time, and that is what's failing. It does grab the screen, rotate to widescreen, and go black while it loads stuff, and it does write a gemrb.log, so it must be running. I can't imagine that it would get this far if it was an API problem.


Edit; it sometimes gets a bit further now, until NUMBERS2 and then crashes in the middle of logging a word. Memory issue? I'm trying to compile an earlier version.

Link to comment

I found out that the API level in prep_env does have to be set to an available API, else the script fails. Available APIs seem to come from whatever packages one installed from the android SDK manager.


Currently hacking the 0.8.1 prep_env to get it working. Almost there.

Link to comment

Wanted to see if earlier versions would run the game without crashing. Managed to hack 0.8.1 until it would compile, but ant failed for reasons I couldn't decipher. The old android sources seem to be really messy.


Edit: Building from git now. Your $APILEVEL in prep_env doesn't work.


Edit 2: The git version builds and installs, but crashes/errors out without even writing a log or populating the cache folder. alogcat shows nothing. I have no idea where I should look to fix this problem.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...