Building High Quality Apps and Games with Firebase (Google I/O '17)

Just another WordPress site

Building High Quality Apps and Games with Firebase (Google I/O '17)

[MUSIC PLAYING] NALIN MITTAL: So today we’re going to talk to you about building high quality apps and games with Firebase So today, building high quality apps has never been more challenging When you’re building for so many different countries, each with their own set of devices, languages, and carriers, how do you know when your app is ready to launch? And after you launch, how do you monitor your application to make sure it’s stable and performant in production? Well, we’ll get to that in just a minute But first, why is this even important? It’s important because the data shows that the quality of your application has a direct impact on your business Slow and crash-y apps mean bad user reviews And bad reviews mean lower trust in your application, and ultimately fewer users, and fewer– lower revenue In fact, a recent analysis of Google Play Store reviews shows that 50% of the time, when a user– 50% of one star reviews mentions app stability and bugs as a problem And on the flip side, 60% of five star reviews mention speed, design, and usability So the data here speaks for itself If you have a low quality app, your users will notice, and it will impact your business So how do we build high quality apps? Well, it looks pretty straightforward on paper You build the core functionality of your application You test it, either manually, or, ideally, in an automated fashion You launch and distribute it in the app store, and then you actively monitor it to make sure there’s no problems And you take those learnings, and you repeat But in reality, we know that this is very difficult to do without the right tools And so at Firebase, we have some great tools to make your life easier We focus specifically on the test and monitor phases of your Lifecycle And before you launch, we have something called Firebase Test Lab, which helps you test your app against a variety of devices to make sure it’s in good shape before you launch Then we also have tools that help you monitor your application after you launch in production So we have crash reporting, which helps you find errors and crashes in production, and alerts you of new and regressed clusters It also helps you find the root cause of the problem by giving you stack traces, and helping you identify what actually caused the problem And then, crashes are a big problem But often the problems that are toughest to diagnose are performance issues So what’s causing your app to be slow, and why? So we’re really excited to tell you about our new product, Firebase Performance Monitoring, in just a minute So let’s talk about Firebase Test Lab So Firebase Test Lab is a physical and virtual device lab in the cloud We know most developers only have access to a few devices to test their app on, so our goal is to give you easy access to a wide variety of devices that represent your user base And that’s why we’re constantly adding new and popular devices from around the world When you run a test, you can choose a combination of devices, OS versions, and languages to make sure that your app is going to work well for your user base And we’re also aiming to have the latest developer previews in our lab, so you can make sure that you’re supporting the latest Android features with confidence Now, every developer has a different workflow So we have different ways to access the Test Lab You can use the web console, the command line interface, and even Android Studio And we also support popular testing frameworks like Robotium, Espresso and UI Automator Now, what if you don’t know much about testing, or you haven’t had a chance to invest in test automation? That’s exactly why we built Robo So Robo is an intelligent app crawler that will find crashes and lay out issues for you, and you don’t have to write a single line of code All you have to do is upload your APK, choose what devices you want to run on, and it will crawl your application And while it does that, it will record a video, take screenshots, capture device logs, and even stack traces for any crashes it might encounter Here, you can see how Robo’s crawling the I/O 17 application Robo also powers the pre-launch report on the Play Developer console So a lot of you probably have used this in the past This is available at no cost to you It’s a limited set of devices that Play will automatically run your app on if you participate in the alpha/beta channels It’s a great way to try the product at no cost

Now, we know many of you who do invest in testing like to run on every push and commit So we have integrations with some really popular CI tools, like Jenkins and Travis In fact, we have really great partners like AMEX and Walmart that are using Test Lab in this way In fact, Walmart recently open sourced two amazing tools for the community The first one is Flank And Flank lets you shard and throttle a large number of tests against our Test Lab This is one of our most-requested features, so we’re really excited that Walmart built it before we even did, and made it available to the community And the second one is coming soon It’s called Shifu, and it lets you mock– it’s a mocking tool that lets you mock your database, or your data and network requests, so you can build that hermetic test suite So if you have a CI environment, and you test on every build, and you’re struggling with device compatibility testing, Firebase Test Lab has some great options for you And that’s Firebase Test Lab So last year at I/O, we launched Firebase Crash Reporting in beta And Firebase Crash Reporting monitors your application, and then alerts you when you have crashes, and other nonfatal issues Now, the key here is, we wanted to do more than just identify the crash We wanted to help you reproduce issues So we did in the fall of last year was integrate with Google Analytics for Firebase to show you what your user is doing in your app before the crash And this lets you reproduce that in your own environment very easily Because we think that’s kind of the most challenging part of fixing crashes But this year, we have even bigger news So Firebase has joined forces with Fabric, as you’ve heard probably a couple of times today We’re really excited about– we’re really working hard right now to build– bring the best of both platforms together And we’re excited about Crashlytics because it’s the best crash reporting service in the market It’s used by over 500,000 developers, and it gives really great real time insights And what we’re excited about is, we’re bringing this to the Firebase community So that means in the future, you can expect to get the entire Crashlytics experience right from the Firebase console So if you’re thinking about integrating new crash reporting tool, and you don’t have one yet, we recommend Crashlytics But current Firebase customers don’t have to worry We’ll upgrade you seamlessly to the new experience when it’s ready And we continue to support that service And lastly, I wanted to talk about Firebase Performance Monitoring So Firebase Performance Monitoring lets you see what’s happening with your application as users are using it in production We had two goals in mind when we built this product One, we wanted to provide a ton of value out of the box without having to do anything And the second thing is, we wanted to make our insights actionable So everything we show you, give you a way to fix it, or at least debug it and diagnose it a little bit So out of the box, just by installing the SDK, you get visibility into your app startup time, and all of your network requests And then, you can also instrument your own– you can do custom instrumentation to diagnose specific parts of your application, and time those Now, whether you’re using– looking at our out of the box insights or custom insights, we give you the ability to slice and dice the data in a number of different ways So you can look at, how does this particular– how does my app startup time look by carrier, or by OS version, or by app version? So that really lets you kind of hone in on the problem It’s a really powerful tool, and we’re going to be deep diving into it tomorrow at 4:30 right here So we hope you can join us for that And now I’m going to hand it off to Justin JUSTIN BROUGHTON: All right, thank you Nalin So, I’m going to give a deeper dive into some of the new features on Test Lab So for some time now, we at Google have been stressing the importance of writing automated tests So how many of you– raise your hands, how many of you write automated tests for every new feature in your application? All right, that’s why we’ve given up nagging you It doesn’t work So we are putting a lot more focus now into automating the crawl of your applications with the Robo We’ve already made improvements in this area in terms of the performance, how many cra– how about how fast the crawler is, as well as the coverage– how many screens we can find, how many crashes we can find But you can expect to see even more significant improvements in the coming weeks and months But there are always the deepest, darkest corners of your application that even

our crawler cannot find So with Espresso Test Recorder, you can– which is part of Android Studio, you can record a test by interacting with a device, a local device with your app, and upload that test to Test Lab And thereby test those hard to reach parts of your applications So Nalin talked about the new Firebase performance product, which gives you insights into how your application behaves in the wild We on the Test Lab team believe it’s equally important to understand how your application performs before it even gets into your users’ hands So with every test that you run in Test Lab that runs on a physical device, we measure various performance metrics, such as CPU, and memory, and network And we provide you those as part of your regular tool test results synced with the video You’ll see this in a demo later on All right, who wanted more devices? Oh, come on I’m going to ask again Who wanted more devices? Yes [APPLAUSE] That’s better, all right Yes Well, we now have more devices We’ve added more of the newer devices If you heard Francois’s talk, yes, we have Pixels, yes, we have S7s, S7 Edges We also have some of the older devices, more of the older devices We also have a preview version of Android O running on the Pixels So now you can test out and integrate with some of those new features that they talked about at the keynote this morning So we’ve known for awhile that the quality of the network connection can really affect the usability and the reliability of your applications And so with G Cloud in the release that follows I/O– one week after I/O, with G Cloud, which is our command line tool, you can now test your applications under a variety of different network conditions Everything from LTE to Edge to GPRS, and so on You can even test it under degraded versions of those same network profiles But what I am most excited to talk about today is our new support for testing games So we’ve talked with many developers who are creating games for Android And from those discussions, the key takeaway, for me, was that testing games on Android is incredibly painful And because I had gum surgery a few weeks ago, and that was incredibly painful, I immediately thought of this And if there are any denta-phobes in the audience– if you don’t know what a denta-phobe is, if there are any denta-phobes in the audience, you can look away now But this, unfortunately, is the–anyway So the– this– I think we already– this is– the pain of testing games on Android is not quite the same pain as we see here But given your feedback, given the discussions we had, it is almost as intense So this person recognizes that there are thousands of different device types out there And it’s impossible to test on all those different devices This person had to build five different versions of their game for Android, and then test each one of those separately This person had a game which bricked a device that they did not even have in-house A very important device that they– that the only thing they could do with was blacklist And lastly, the thing that we heard most often was that it is hard just treading water, keeping up with all the different operating systems, versions, and releases So what are we doing about this? And the denta-phobes can now look back on the screen again So we’re going to do a number of things, but I’m here, really, today to talk about just one of those things Today we are introducing a new framework for testing games on Android So with this new framework, we allow developers to create game loops, and trigger those game loops So what is a game loop? Well, I’m sure most of you have been to an arcade And while the games are not being played,

they are running through a loop demonstrating their behavior And that is essentially a game loop So a game loop is a way of simulating a user interacting with your game It can also be used as a way of stress-testing a game, such as in a multiplayer situation, or focusing on a specific game component Now, you can trigger game loops with this framework locally using an application that runs on the device that we’ve written That application is freely available to you You’ll find it by going to our website, our documentation code for Test Lab, and you search for game loop, and you’ll find a reference to it That is freely available to you You can download that, run it on a local device, and trigger the game loop But what is more important is that we’ve added support for game loops in Test Lab So now you can, with Test Lab, simultaneously test your games, triggering game loops across any of the devices that we have in our device fleet, and expose problems Problems such as crashes, or memory leaks, or, probably more importantly, graphics performance issues So to help us understand how this works, I am extremely– I mean this, extremely excited to welcome one of our partners up on stage with us They’ll be up in a second Deep Silver FISHLABS Deep Silver FISHLABS, who, as you probably know, is a world leading developer of high fidelity 3D games for smartphones and tablets Their latest game, Galaxy on Fire 3 Manticore released this morning But it is, frankly, a benchmark of sci-fi shooting games They have been testing a pre-release version of their game on Test Lab for some time now And as I say, it released this morning, but I’ve been testing this game for a while And I can honestly say that the last game that I was this addicted to was about 25 years ago And I can see some raised eyebrows, the incredulous in the audience Yeah, they did have computer games 25 years ago So let me welcome up Andreas and Johannes on stage Andreas is the director of business, the director of business development and sales– ANDREAS STECHER: Thanks, Justin JUSTIN BROUGHTON: –at Deep Silver FISHLABS Welcome Andreas And Johannes is the head of core technologies, a lead developer at Deep Silver FISHLABS Welcome, guys All right, so we’re going to start with you, Andreas, I think What do you see as the main advantage of the new support for testing games in Test Lab? ANDREAS STECHER: Yeah, hey Thanks, Justin Well, as you mentioned before, the challenge that we basically face is that we want to have our game running on as many devices as possible So what we face– I mean, you’re very, very successful with Android So you have multiple OEMs deploying it on the devices Those multiple OEMs have multiple devices So I think today, if you look into Google Play, you have over 13,000 different devices with OS’s, so it’s a big challenge We look into that and say, well, what’s the market share? And so on So today– or up until the last few months, basically, before using Firebase Test Labs, we went out and tried to purchase as many devices out there as possible And if you buy one of the latest phones out there, probably cost you $800 So imagine if we want to cover 100 devices, how pricey that basically is So that’s one thing where the Firebase Test Labs helps us Because as you just mentioned, you provide us with test devices that we can run our game on That’s one thing And by the way, we have this very, very little vault in our office where we stack 100 devices But 100 devices are basically not enough We are– or, the goal that we have for our gamers, that we want to cover about 500 different devices Well, why? To have a meaningful user base So that’s one challenge The other one is that one device of one OEM might not have the same hardware inside in the US

as in Europe or as in Asia So what we sometimes faced in the past was that we got user reply saying, hey, it doesn’t run on a X, Y, Z device And we tested it in Europe and said, well, it runs with us But then we have to find out that they use different GPU or CPU And how should we get, as a developer, devices from Asia? So again massively help there So that’s something that basically helps us to overcome that challenge And the research I mean, the time that we put into research before, finding all that out, that hardware stuff, was immense I think for Galaxy on Fire 3, we had a product manager for about two months just searching databases of what’s the device market share in different countries to try to get those devices So Firebase Test Labs really helps us there because we don’t have to do that work anymore We’re saving money, and we’re quicker So JUSTIN BROUGHTON: That’s great And then, how does this affect your overall launch process? ANDREAS STECHER: [LAUGHS] As you imagine, we’re quicker So basically, three things– we’re quicker in getting the game out there, it’s more effective in terms of QA and testing, in that sense, and also we’re more confident I mean, as I mentioned, and you also, it could be that we have to blacklist a device earlier on that was a product that has a market share of 5% in Asia Now we’re confident that we say, you know what? We don’t want to blacklist it because we’ve tested with Firebase Test labs, and we’re confident So we are quicker for QA So development time is quicker And I guess you all know that less development time means less budget So you can save budget on that one Secondly, as I said, more confidence We can cover more devices More devices means we make more gamers happy out there with a product They’re there, they’re playing it, they’re writing great reviews on it because they don’t get bugs, they don’t get crashes And we’re more happy with that And then because we’re quicker, and we’re more confident, we’re covering more devices, by the end of the day– and I’m bizdev in sales, we’re making more money And that’s what we want to do JUSTIN BROUGHTON: Which is the point, yes ANDREAS STECHER: Yes [LAUGHS] JUSTIN BROUGHTON: All right, thank you, Andreas Really appreciate it All right, Johanes Highness You’ve been patiently waiting, I think, to give us a demo So please JOHANNES KUHLMANN: Yes, finally Thank you, Justin ANDREAS STECHER: [LAUGHS] JOHANNES KUHLMANN: Yeah So for that I will need the MacBook I’m going to show you how we added support for the game loop to our game, Galaxy on Fire 3 Manticore And we’ve been using the Test Lab for some time now, and I’m very happy that it has helped us improve our game, and also with the launch So the very first thing you need to do is, you need to declare your support for the game loop And you do this in your manifest And for that, I will just jump right into Android Studio So the first thing we do here is, we add an intent filter to our activity And the action’s name is LOOP And that’s pretty much all you have to do You can also add some more metadata here, like how many different scenarios you support But we currently only support one And in that case, that’s not really required The next step then is, you need to check for this intent when your app starts And we do this in our activity in the onCreate function here We get the intent, we get the action, and compare the action’s name to the string we also saw earlier in the manifest And then, the only thing we do here is, call this native function force performance test, which, at this point, basically only sets a flag in native code, which we then later check once our native code spins up in order to determine if the game should run in this game loop mode or not So all the actually game loop implementation happens in native code where we load different locations and missions after each other in order to see if they work at all And also, in order to determine the performance So once that is done in native code, we hand back control to the activity by calling this native notify performance test end function And according to the game [INAUDIBLE], all we need to do in order to finish, or to show that we are done, is called the finish function on the activity And that’s pretty much all you need to do for the implementation The next what do you want to do is, you actually want to run the game loop And as Justin said earlier, there’s a little app that you can install on your device So I will do a demo on the device now Can we switch to the device? Yes So this app is called Test Loop Apps, which I have installed here So I will just tap that And when it opens, it gives you a list of all the apps on this phone that support

the intent we saw earlier So currently, this is the only our game at the time So I will tap that Then it gives you a list of scenarios, and we currently have one, so there’s not much to choose from But quite important up here is that you can set the timeout, which defaults to three minutes, which might be a bit short for the game loop, I guess So and then when that’s done, you on tap on the Run button, and this will launch our game in game loop mode And stops loading the first location And once the loading is done, we will see some action Yeah, so this works And then the next step is– or, the next way to run the game loop is– you can also do this in the Firebase Test Lab, so we switch back to the MacBook for this So we go, head over to the browser and Firebase, and select the Test Lab on the left So here you can see, I did some tests before, which passed, and some which failed But we want to run a new test, so we click on the Run A Test button here And the Robo test and instrumentation test, those two are old, but what you want is the game loop here So we click that And the first thing we need to do here is, select an APK So I will just choose a very small one here, because now it does the upload And then you can also choose the scenario you want to run here But we will just go to the next page where you can select the devices, and API levels you want to test on So once you’ve selected that, you can click the Start button down here in order to launch the game in game loop mode on the selected devices in the Firebase Test Lab Of course, the running of the game takes some time, so we– for the results, I will just choose one I did before So for example, this one So it gives you a list of all the devices that the test ran on In this case, this is our Vulkan build of the game, so there are not that many devices But we can look at the Pixel, for example On the first tab, it gives you some additional performance data that we ourself generated during the run But here you can also look at the logs, which is mainly advantages– mainly beneficial if there were any problems or crashes during the run, so you can figure out what went wrong You can also look at a video of the run, but I will just skip over to the Performance tab because we also have the video here, and some additional performance data like the CPU usage over time The graphics performance measured in FPS here, the memory consumption, which doesn’t really go up, so I don’t think we have a memory leak in here And the network usage as well And the cool thing here is that you can actually click on the graph So if you wanted to figure out why we have these frame drops here, we can click on it And we see that the video jumps to that point in time And we can play the video from there, and we see it’s the loading screen So it’s not that bad that we have frame drops here And once the loading screen ends, we see that the performance goes back up to the 30 FPS we are aiming for So this is running the game loop via the Firebase Console, but you can also use the– run the game loop via the G Cloud’s command line tool And for that, I head over to the terminal So this has the advantage that you can also use OBBs, or APK expansion files, which, for games you might often have And you can also easily integrate this into your continuous integration open server set up So there are different commands For example, you can get a list of the devices in the test lab This is basically the same list we also saw in the console earlier But you can also start the test, for example, with this command You specify the type as the game loop You can also specify the timeout here You provide the name of the APK, the name of the OBB files Note the naming here that the OBBs already have to have the correct name So they have to include the version code that is part of the APK And you specify the devices, and API levels, and the orientation you want to run on And once we run this command, it will start uploading the APK and the OBB files to the test lab And once the upload is done, it will start running the game loop on the selected devices It will also give you a link to the results in the Firebase Console so you can look at the results just like we earlier did And that’s pretty much all there is to it You have to add the intent filter to your manifest, check for the intent on start up, implement some launcher for the game group in your native code, and then run using one of three methods I just showed you And with that, back to the slides NALIN MITTAL: Thanks Johannes, that was awesome That’s how you use– [APPLAUSE]

That’s how you use the game loop feature of Test Lab And so if you’re interested in testing your games, please go to Firebase JUSTIN BROUGHTON: More excitement, Nalin Come on, look at her, she just ran a game loop Come on, yes Come on, yes NALIN MITTAL: All right, well, clearly Justin’s very excited Yes, use game loops, run them locally, run them on Test Lab to make sure they work on your users’ devices We’re really excited to show this to you in person To recap quickly, I wanted to just recap what app quality tools we have in Firebase, and how they work So before you put your app in the hands of your users, make sure you use them o– make sure you test your app on Test Lab to make sure it works on all the right devices After you launch– you’ll never catch all of the issues before you launch So after you launch, make sure you monitor your application, and its stability and performance with crash reporting And then finally, use performance monitoring to see where your app is slow, and why And definitely tune in tomorrow for– right here on this stage at 4:30 to get a deep dive into performance monitoring It’s a really exciting product, and we can’t wait to show it to you And then finally, come see us at the Sandbox Johannes and Andreas will be there You can talk to them about how they implemented the game loop We also have another game, Mecha Hamster, that’s an internal game And we’re happy to show you hands-on how we integrated game loops into these experiences And come find us We have the engineering team that will also be there that’s excited to talk to you And yeah, thanks for coming everyone Have a great I/O JUSTIN BROUGHTON: Thanks very much [APPLAUSE]