From the course: Android App Development: Design Patterns for Mobile Architecture

Potential errors - Android Tutorial

From the course: Android App Development: Design Patterns for Mobile Architecture

Start my 1-month free trial

Potential errors

- [Instructor] Before we jump into the project, I want to navigate you through some potential errors that will come up as you bring the project over to your computer. First, let's go ahead and open this by Open an existing Android project. Paste the url to the actual project and click OK. Now, first you will see this type of warning, and all it's really saying is the Android SDK that was located in the project is not the same as the one on your machine and it's asking you specifically, do you want them to change it. So you can just click OK and don't worry about any errors. Next, this will go ahead and build with Gradle and Gradle will tell you if there are any additional warnings or errors. So this is telling me that this start project is not building from Gradle anymore and that we need to check those out. Click OK and we're waiting for Gradle to build down here at the bottom. And it looks like Gradle is okay. If you go ahead and open up this Project tab, move this over to the Android View and open up these Gradle scripts. Going into this module, just make sure that you have 25.0.2 or in this case it's recommending that we move to 25.0.3. So you can just click on three, click on Sync Now and it'll let us know if there are any other errors or concerns. Another potential area for errors that you might have is going into Tools, Android, and SDK Manager and under the SDK Tools, and click on Show Packages and Details, just make sure that in this constraint layout you have 1.0.2 and a solver for the constraint layout you have 1.0.2 and then click OK and it should download those. The next thing that we have to have to run in place is a simulator. When you first try to run the application by clicking the Start button, you'll notice that there are no virtual devices. Just click on the create new virtual device and choose any one that you particularly want to use. Click Next. You might have to download one of the APIs to run on it. In this case, we're going to be using API 25. Click Next, you can leave the default options and just click Finish and this will create a virtual device for you to run your code on. Click OK and you should be able to run the code. There's one other thing that we might need to get in place in order for your simulator to run correctly. If you go up to the Tools menu, and come down to Android and click on the SDK Manager, and then if you click on the SDK Tools, make sure that this HAXM Installer has been checked. This will allow you to run your code natively in x86 code and it'll make your simulator run a lot quicker. And another potential problem that you might have. If you come into here in the instant run you might need to disable this in order for the code to deploy correctly onto the device. This is still a buggy process and in some cases it doesn't work for these type of projects. Another place that you can get an error is if you're opening up an existing project and it doesn't have a particular file you'll get this warning down here at the bottom. If you click on the details, it just says that the _Start.iml or the 03.02_Start.iml or some number, all you have to do is just click on Remove Selected and then when you close the project a new iml is created within your project. This is just an Android Studio specific file and it recreates it if it doesn't exist and it's an easy error to resolve.

Contents