Discussion on Blappy Bird Source Code - Android Studio Project

33 comments found.

Hi, is there a way to keep both Banner & Interstitial Ads ?? I seen a comment above where you said to add Interstitial Ads , “remove” the banner ads…....I would like both ad platforms if possible. Also would it be possible to add a leaderboard ? Thanks…...

Hi there, currently there is no leaderboard in the app as it requires connecting to your own google play account, or to run your own server. Probably the easiest way to put a leaderboard in is to use the Google Play Games leaderboards, you can read about it here: https://developers.google.com/games/services/common/concepts/leaderboards.

I might look at putting one in in the future, but I’ll have to think about it as the setup for the end user would be more involved.

I have studied your documentation on how to add sound (mpg.3, ogg’s) but I want to loop a background music mpg3, I am able to add it as a sound, but it starts at the start of the game and again when the bird dies so it is playing over itself. How can I begin playing the background music at start up, and it stop automatically when the bird dies? Then repeat the same process, on at start up, off when bird dies. Thanks for this really cool app, one of the best I have purchased on here, and you have been so helpful.

Hi there, thanks very much for your kind words. Glad you like it. Sure that is definitely possible, though adding background music is slightly different to adding sounds. For background music I would recommend using the android MediaPlayer class.

I made some instructions for adding background music to the app, here:


These instructions will start the music when the user starts a new game or when the app starts, and pause or stop the music when the bird dies.

Hope that helps. If you get stuck please do let me know. Thanks again, Steve

hi can you plese add chartboost ad network? i will buy then..

Hi there, hmm I am not sure about putting this in the main release, but it can be done as a custom job no problem.

Hi, please check your email. I wanted to buy this game with few changes.

Hey! Nice job! I just wanted to know what do I need to change in the code so that my bird dont die when it hit the ground, but at the same time that the ground is still visable? :)

Hi there, Ok open up Wall.java file in Android Studio and find this line (Ctrl+F will find it for you):

y = rnd.nextInt((mCanvasHeight – groundHeight) – 500) + 300;

There are 3 of these lines identical, one on line 91, one on line 153 and one on line 229.

Change the numbers 500 and 300 on those 3 lines to change the max heght and min height of the walls. You will have to play around a bit with these numbers to get the height you want. If you increase the 300 number I think that will move the gap towards the centre of the screen more.

All 3 lines should have the same values.

Thanks! Here you can check my app.. https://goo.gl/L5k7FZ

Fantastic! Great job, well done!

Hi mate,

I am finding a bug and I am not sure how to solve it. When you run the game, play once and hit game over, that you have the “play” button, if in that moment I hit the android home button and then I reopen the app with recent apps button, the resolution gets all mess up, everything looks bigger and you cannot press the play button again (actually the button is in one place and the touch area in another).

I have try with your demo APK and it does not happen. I try with a fresh install without changing anything on the code and it happens. I can reproduce in my physical Nexus 6 phone with API 24 and on an Emulator Nexus 5x with API 23.

Any hints? can you reproduce?

Hi there, hmm ok let me investigate. What is your compileSDKVersion in the build.gradle file? If the demo APK is fine, maybe reduce the compileSDKVersion number to a lower version and see if it makes a difference. I will have a look shortly and let you know ok..

Hi, thanks for spotting this. The solution is to open up the GameView.java file, and find this line which will be around line #176:

holder.setFixedSize(720, 1280);

and replace it with this:

holder.setFixedSize(width, height);

I will upload this update to codecanyon with the updated code asap. Thank you so much!

Have recently purchased from you and overall very happy with the game. I have run into an issue that is only relevant to tablets (as far as i can tell). I changed the game speeds and jump distances using your guide and all works perfectly on android phones however when you install the same APK onto a tablet the jump distance changes are exagerated to the extent it makes the game unplayable. I’m Using Android Studio v2.2.3 and everything is up to date – I generate the signed APK without errors and installs fine on phones but its just when installing on tablets that the issue occurs (tried both samsung 7 inch running Jelly Bean v4.2.2 and 10.1 inch samsung running Kitkat v4.4.2. Have you come across this before and/or can you advise how this can be fixed?

Yes they are: Samsung Galaxy Tab 2 7 inch – 600×1024 pixels (170 ppi pixel density) Samsung Galaxy Tab 4 10.1 inch – 1280×800 pixels (149 ppi pixel density)

Thank you very much. I have found the issue only occurs on tablets classed as mdpi pixel density, which both of yours are. The quick fix is to:

1. Open the file BirdSprite.java file in Android Studio

2. Find this piece of code, which is around line 84:

DisplayMetrics displayMetrics = gameView.getResources().getDisplayMetrics();
float dpHeight = displayMetrics.heightPixels * displayMetrics.density;

3. And replace those two lines with this code:

DisplayMetrics displayMetrics = gameView.getResources().getDisplayMetrics();
float density = displayMetrics.density;
if (displayMetrics.density == 1.0f) {
density = 2.5f;
float dpHeight = displayMetrics.heightPixels * density;

Where it says “density = 2.5f”, you can change this number to suit jump distance for mdpi tablets to your liking. Probably somewhere in between 2.0f to 3.0f would be ideal.

I will work on putting this into the release code. Thanks!

Thank you – this has resolved it

thanks for you phantomapps! Here you can check my app https://play.google.com/store/apps/details?id=com.landmark777.flyminer

Wow great work. Well done. I have just downloaded it and will give it 5 star rating.

Hello Thank you for the Code ;) please how i can solve this error ; “Error while waiting for device: Timed out after 300seconds waiting for emulator to come online.” thank u so much ;)

Hi, Sorry for the delay. Did you get it sorted? I think it is an issue with the emulator setup on your computer. There are some solutions provided here: https://stackoverflow.com/a/41430226/3719104

Hello, I found the bird very slow how to increase the speed of the bird please answer

Hello, yes you can easily change the bird speed and other speeds in the dashboard.xml file. You can change the bird acceleration speed, bird jump height, bird fall speed, and the speed of the columns moving from right to left, the overall speed of the game and many others. Please see here for more info http://blappybird.helpdocsonline.com/d-using-the-dashboard


Ipock Purchased

Your instructions are the best I have ever seen and easy to follow. I’m just stumped on one thing. I’ve never worked with a 3 image frame. How do I change the bird in these to something else? My images are of a single bird.

Hi, thanks! I have emailed you with the response to this. Let me know if you need any further help.

Hi Bro, May i know how to add google analytics to the app. please… your guide is amazing… could you hep me with this pls

Hi, sorry I am not familiar with adding google analytics to apps, what are you trying to track? Ad clicks or something else? I think Google developer console already has very good analytics once you publish the app. You can msg me at phantom1apps@gmail.com if it’s easier :)

Hi everyone. With Android Studio 3 now out, there is a small change you need to make to the code to make the app work in Android Studio 3:

1. in Android Studio, open the file app/build.gradle
2. Find this piece of code on line 15:

applicationVariants.all { variant -> variant.outputs.each { output -> def newName = output.outputFile.name newName = newName.replace("app-", "$rootProject.name" + "v" + versionName + "-") //noinspection GroovyAssignabilityCheck output.outputFile = new File(output.outputFile.parent, newName) } }

3. And replace it with this code:

applicationVariants.all { variant -> variant.outputs.all { output -> def newName = output.outputFile.name newName = applicationId + "v" + defaultConfig.versionName + "-" + defaultConfig.versionCode + ".apk" outputFileName = newName } }

We will upload a new version very soon which has this code already in the package. Thanks!

EDIT: The new version has now been uploaded to CodeCanyon. Please use Android Studio 3+ when opening the project.

Hi, I need to add bgMusic so I have uncommented all the code in Start.java but when it create a new GameView Android Studio says that there is no contructior that can create it.

Around line 60:

gameView = new GameView(this, null, bgMusic);

Hi, sorry for the delay over the Christmas/New Years period.

If you want to add bgMusic, there’s a few other things you need to do:

1. If you have already uncommented the new gameView constructor gameView = new GameView(this, null, bgMusic); which includes the bgMusic, then:

2. Comment out or delete the original constructor on line 110: gameView = new GameView(this, null);

3. Then in GameView.java, uncomment line 130: // private MediaPlayer bgMusic; Also uncomment line 141: // this.bgMusic = bgMusic; (remove the //)

4. Then change the text at line 138 from:

public GameView(Context context, AttributeSet attrs) {


public GameView(Context context, AttributeSet attrs, MediaPlayer bgMusic) {

If you get stuck, please email me at phantom1apps@gmail.com and I will help you further.