Could someone help install a working android development environment?


I migrated your project into a Blurrr SDK infrastructure and got it
built and running on Android (And also Mac and Windows Visual Studio
2015 because I had them open at the time).

I posted the project on GitHub. (I suggest you look at the commit
history to see the changes and fixes I made.)

And here is a pre-built APK so you can see it. (Tested on Nexus 7 running 5.1)

Your program has some bugs. When I launch the program, music starts
playing. But the graphics are flickering and kind of corrupted,
flashing between what looks like a main title screen and a loading
screen. (This is happening on both Android and Mac.) On Windows, I get
the music, but the graphics are a blank white window. (This doesn’t
surprise me since there seems to be a rendering bug in your program.)

You have expressed massive frustration with trying to build your
project. As I tried to tell you earlier, this is the exact problem
Blurrr SDK tries to solve. Blurrr SDK makes it easy to setup a build
environment for cross-platform development.

For Android, you just set the Android SDK and NDK paths in the
BlurrrGenProj preferences panel and it can then generate an Android
Studio project for you which you just hit build. (And Blurrr also
generates Mac & iOS Xcode projects, Windows Visual Studio projects and
Linux Makefiles.)

Anyway, if you have more questions about the project changes I made,
or using Blurrr SDK, feel free to contact me.



Justodot, ok, i got it built and installed using ordinary NDK tools, but when trying to run, some was not found. I think it’s about some further configuration, but it was too much to do, and i were too tired to continue. Make sure to use the latest stable version of NDK, r14b.

[Link removed by request of JonnyD]


Thank you so much Eric. I am very relieved. But off course worried about the render bug now. Could the testing values on line 1630/1631 in mainScreen.cpp be a cause? I used those to test on a small screen on my laptop.

Most changes you made make sense with the acidental double renderer ,unused windowtexture, changes to mixer and porting to blurrr.

it runs perfectly fine on my laptop , music and graphics with no flickering or white screens? I notice in letterRects() it uses event.button.x , which is still off course for testing on my laptop, should be event.tfinger.x for mobile .

i also noticed you commented out the code in focus-lost focus-gained window events for muting sound? It worked perfectly on my laptop to mute sound when the screen was minimized or lost focus? is it something that should only be done on a laptop? Sorry everything sdl and developing for android is new to me :slight_smile:

You have been so helpful, I can’t thank you enough :blush:


Yes, actsl , I got the error earlier too . I don’t know it’s very complicated, way to complicated for any beginner.
I will give blurrr a try I think :slight_smile:


I caught some bugs in your code, such as your use of a "bool success"
variable in both a parent and subclass. On Mac/clang, one variable was
shadowing the other which ultimately resulted in the one you call in
the main loop to always return 0 and the program self terminates. I
wouldn’t be surprised if you had more bugs like that which your
current compiler is letting you get away which isn’t guaranteed to
work correctly everywhere.

Though this flickering/corruption bug looks like it is probably due to
a misuse of the graphics API. Since I reproduced this on Windows, Mac,
and Android, my first guess is that your video card driver may be
allowing you to get away with stuff. However, it could also come back
to compiler differences or something else. But if you continue using
Blurrr, this should be straight-forward to start debugging. Just
install Visual Studio 2015 Community edition and use it with Blurrr
and you will hopefully be able to reproduce the problem on your own
Windows machine (since it will more closely match my environment).
Visual Studio has a pretty nice debugger so it is easy to step through
things. (Though I recommend disabling your FOCUS-in/out code because
it will drive you nuts working with the debugger.)

I’m also a little suspicious. Do you have a different codebase for
your Windows build? I didn’t see and MOUSE event support, only finger
support. I’m not sure how you control this thing on the desktop. And I
had to modify all your resource file paths so it would work
cross-platform. So if you have 2 codebases, that is another potential
reason for the differences we’re seeing since I’m working off your
Android base.



Sorry, I missed a bunch of your message because Discourse didn’t show it all on the email side .

So I’m not sure what lines 1630/1631 point to now. In my version, they now point to audio code.

Mouse: SDL has a feature where if you implement the mouse down/motion/up, it also will automatically handle single figure input. SDL has a desktop heritage, so most people start with the mouse and then get basic touch input “for free”. You managed to start the other direction which is actually not unreasonable considering how big/popular mobile is today. But it may be useful for you to implement the mouse stuff.

Focus: I commented it out and forgot to uncomment it back in. I did this because I was using the Xcode debugger. As I mentioned in my other message, this behavior will drive you batty because you constant switch focus using a debugger.


Yes I have a desktop version codebase with MOUSE events and this one for mobile.

I feel the class/subclass use of variables was very clumsy (I know off course inheritance). But well. My compiler is probably too forgiving so I couldn’t catch these bugs earlier.

Do you think the flickering bug should be easy to debug ? What do you mean with 'a misuse of the graphics API ’ ?
I will install Visual Studio and Blurrr , see how it goes. So the FOCUS in/out code is correct to use in the mobile version , just not good while debugging?

lines 1630/1630 , should be 1654/1655 I see now. was where I set some values for newwidth and newheight as well as set multiplierw and multiplierh to 1 just while testing the various screen sizes, but I forgot to remove it .

And I will continue to use the new ALmixer / blurrr cross-platform porting as well in future code that is very helpful.
Thanks :slight_smile:

btw , if you have a paypal account , & everyone else who has helped, I want to give something at least for your time & effort :slight_smile:


Generally you should have a unified codebase. SDL is pretty good about allowing this. I wrote the Blurrr SDK examples to demonstrate good practices for this. I’m particularly happy with the FlappyBlurrr example as I officially got it to work on 6 different platforms (8 unofficially). There is minimal #if PLATFORM code.

For mobile focus events, SDL provides SDL_SetEventFilter which lets you set up a callback for critical system events like application backgrounding. The Blurrr templates and samples show how to use this. Look for TemplateHelper_HandleAppEvents(). I recommend SDL_SetEventFilter for these because one of the problems with these specific OS events is that sometimes polling for them in the main loop will be too late.

The newwidth/newheight stuff isn’t connected to your rendering problems, just the window size as far as I can tell.

I looked through your code. First, I think you want to use SDL_RENDERER_PRESENTVSYNC instead of SDL_RENDERER_TARGETTEXTURE. I believe the latter is for render to texture (instead of screen).
pRenderer = SDL_CreateRenderer(pWindow,-1,SDL_RENDERER_PRESENTVSYNC);

Second, I set up breakpoints at every SDL_Render* function. From what I can tell, during the main loop, the program is only calling SDL_RenderPresent() and that’s it. This is not typical.

A typical SDL loop does all of the following (every frame):

SDL_SetRenderDrawColor(the_renderer, 0, 0, 0, 255);
// draw all your spites

// Finally draw the screen

The Blurrr SDL New Project template contains a very simple example which shows the typical SDL loop. (Look for Render())

I suspect if you fix your code to follow the typical pattern, the rendering glitch will be fixed.

I have two PayPal links on the download page. One is to purchase a full license. The other is for donations. I hope you will consider buying a license.



It’s not just calling renderpresent as far as I know ? From main it calls gameRunning() wich calls SDL_SetRenderDrawColor and SDL_RenderClear() in screenClear() , and SDL_RenderCopy() in loadStartScreen(), loadMainScreen() etc , in each of these the drawImage() functions call SDL_RenderCopy (or renderClrCpy() which calls SDL_RenderCopyEx) .
I’m not sure how I would change this ?
& how would I go about changing my code to a unified code base?
And mobile focus events SDL_SetEventFilter , where would I add this in my code ,before the gameRunning() loop ? do I just leave the window focus events as they are ?

also is visual studio 2017 community edition good to use ?
Well this certainly has been a learning experience , I will give you credits as well for my final finished app :slight_smile:

I will buy the license and donate as soon as I’ve managed to install it all , which will be fussy again I’m sure with the SDL libraries and visual studio.


After the program gets running, from what I can tell, SDL_RenderPresent is the only thing called. To me, it looks like you called all the other stuff just once, but after you get to the core loop, you never call anything else again. If this is true and not your intent, this is the bug you need fix.

As for unified code base, look at the Blurrr examples to give you a sense how this is done. I also did a bunch of work for you already fixing the resource/asset file stuff. But for mouse, I think you will just add in the mouse event handling to your event loop.

As for Visual Studio, I recommend 2015 for now. 2017 just came out and I haven’t fully vetted it. 2017 might work, but I think you’ve gone through enough suffering already.


I’m sorry but I looked all over your site and can’t find any templates/examples ?
I went to feeling joyful today thinking it was solved and over, to feeling I have to start all over practically :frowning:
I really don’t see where the rendering bug comes from.
It calls SDL_Rendercopy and SDL_SetRenderDrawColor from gameRunning() ( the screenClear() ) which is called repeatedly while running is true ?
Same for SDL_RenderCopy which is called also from within gameRunning() , from teh different screen functions loadMainScreen() , loadToggleGameScreen() etc as each calls a drawImage() function , which calls SDL_RenderCopy .

And SDL_SetEventFilter() , what does it do , would this be easy to add to my code ? Online wiki is not much help .
So sorry to be such a pain, but this has taken a huge toll on me so far. The most frustrating is that it works perfectly fine in my laptop , no flickering or any bugs that I could tell.


The examples and templates are in the SDK download. Create a new SDL project to see a basic one. There are more complicated examples in the Examples folder.

This is what I did. I start up your app. I let it load completely and let it start playing music. I then turn on breakpoints at every SDL_Render* function. What I see is exactly only this is called:

void gameWindow::update() {

That means that in your normal game loop, you are not clearing and redrawing all the elements every frame, which you should be doing.


Okay, I just realized that the FOCUS code I disabled is throwing off my results.

Move this block of code so it is always run, not just on one of the events. Say move it to after the while loop for the SDL_PollEvent.

	            	if(startScreenLoaded) {
						//reload startscreen
					} else if(mainScreenLoaded){
					} else if(letterScreenLoaded) {
					} else if(otherAboutMeScreenLoaded) {

This seems to fix the rendering glitch. (Tested Mac and Android.)
The problem is those events will only fire once per change. The window gets focus and that is it so that block of rendering code will not be run again until after the window loses focus and then regains focus.


oh thank god for that , I was really feeling upset by the rendering problem :slight_smile: thanks :slight_smile: I will try to enjoy some Friday evening now , instead of worrying about this :slight_smile: Thanks again, I will purchase blurrr etc but for now I’m happier :slight_smile:


Justadot, ok, now it builds, installs, and also runs, not complaining any more about any libraries missing or anything else. It was just a matter of making the configuration right. Though nothing appears on the screen when it runs. You also need to link the smpeg2 from SDL_mixer extensions, to the jni directory. It is a step further in building it with NDK tools only. You say it’s too complicated? Well, it will always remain the same, once figured out, not complicated at all any more.

[Link removed by request of JonnyD]


Thanks actsl. But why does nothing appear on the screen, there was no rendering bug after all ? oh yes , maybe I need to move some code around (post 53). But it wasn’t a major bug at least .

off course now I need to add almixer.h
do I download it here ?

and add the files to the jni folder + link in ?

also the question is should I remain with android ndk or move over to blurrr ? Because I don’t want to use both obviously, and whichever is simplest to use ?



I think stay with Blurr until you find out how to do everything you want with NDK.


Oke it’s downloading & installing components for the ndk, jdk, apache etc again for visual studio .
It started to do that after I wanted to create a new project and tried to download some install for android support ? Does it sound correct ?

Hopefully it works now, because I’m not very optimistic anymore :stuck_out_tongue:

& then I have no idea which almixer.h files are needed and how to add support for sdl-mixer, sdl-ttf, and sdl-image.
I found a page here:

but maybe that clashes with my current old setup for android ndk and devc++ , enverionmental variables etc ?
This whole setup thing is just way to confusing for anyone new to it .


If you are using Blurrr, ignore any random webpages about setup.
Blurrr includes prebuilt ready-to-ship libraries of SDL, SDL_image,
SDL_ttf, ALmixer, and others. The point of Blurrr is that you don’t
have to do all this manual setup so you can just focus on your program
(and skip all the trouble and time lost you spent this entire last
month). All that is required is that you install the platform’s native
build tools, e.g. Visual Studio for Windows, Xcode for Mac/iOS,
Android Studio for Android, etc.

For Visual Studio, you just need their C/C++ compiler stuff.
For Android, use the official Google supplied Android Studio/SDK/NDK.
Don’t use Microsoft Visual Studio’s.

Blurrr itself is installerless and is completely self-contained in the
folder you extract to. I’ve gone to great lengths to avoid doing stuff
that will change/screw-up your developer/system environment.

To test to see if you installed your platform compilers correctly,
open up BlurrrGenProj. Create a New Project (big left button). Pick an
SDL C based project and continue. Then make sure Visual Studio 2015 is
selected. Press Generate. If everything works, a Visual Studio project
should open with the new SDL project.

Look at the left side tree panel in Visual Studio. Currently ALL_BUILD
is the bold faced target. But look for one underneath called
MyBlurrrProject. Right-click it and in the contextual menu, select
"Set as StartUp Project".

Now you can git the Green “play” triangle in the center of the Visual
Studio toolbar to build and launch the SDL hello world program.

Once Windows is working, then focus on Android.
For Android, use the real SDK and NDK from Google, not the Microsoft one.
Google keeps changing everything. (I kept my mouth shut earlier to not
confuse you even more when actsl was telling you to use ant and
ndk-build. Google obsoleted those like 3 years ago, and you are
supposed to use Gradle, Android Studio, and CMake now.)

Anyway, in BlurrrGenProj, go to the Menu and open Preferences. You
must specify the Android SDK path and NDK path. This used to be much
more straight forward but they keep changing things in Android Studio.
You will need to hunt a little for these paths.

If you open Android Studio by itself and maybe create a dummy project,
you can go to File->Project Structure to find out the paths.

The SDK directory usually includes a directory called "platform-tools"
and may have a file called SDK Readme.txt.
The NDK directory usually includes a directory called “toolchains” and
a file called ndk-build

Once you set these directories in Blurrr’s Preferences, go back to the
Existing Project you made earlier for the Visual Studio test, and this
time select Android instead of Visual Studio 2015. Hit generate.

Now go to Android Studio and Open a project. Go to where you created
the Blurrr project/BUILD/Android and open that.

You should now have an Android Studio project. The Menu Items "Build"
and “Run” are the most interesting. If you have your Android device
connected to the computer already, then do Run->Run ‘app’

You will get a prompt which will ask you which device you want to
build/run for. Select your device and hit OK. (The emulators
theoretically will work too, but the real device has fewer problems.)
Hopefully this will build and run on your Android device.

This means Blurrr is now correctly configured, so you can just open up
your project that I made for you on GitHub in BlurrrGenProj. Repeat
and rinse.

Please refer to the Blurrr SDK documentation (markdown) in the
download which also describes what I just wrote. And if you want
YouTube visuals, please watch this Part 3 of the Blurrr SDK Quick

If you have problems, please let me know.




So exactly in what order do I install everything, and exactly what , because I may as well start over (again). including compilers ?

I’d much rather deal with programming bugs then any of these extremely fussy setups , it’s been indeed a huge waste of my time. & I’m definitely getting blurrr.

should I also make sure to uninstall certain program / files ? Should I just completely uninstall android ndk etc ?