Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Simple Android App (2014) Getting Started with Android Running the Fun Facts Project

Jason Zwick
Jason Zwick
311 Points

Not seeing what video is showing

When I follow the steps, which are painstakingly explained in the video, I do not see the same things the video is seeing. It's possible I have a newer version, but I can't even get my Android Studio to run the blank app. What's going on?

Harry James
Harry James
14,780 Points

Hey Jason!

Android Studio has had an update recently so, this indeed may be the case.

What is the problem that you are having? Are you able to open your emulator but not able to open the app?

Speak to you soon!

Jason Zwick
Jason Zwick
311 Points

I don't really know enough about Android Studio in the first place to be able to tell you. The video shows me how to create a blank app, but once the blank app is open, I don't see any of the screens displayed in the video. The video then instructs me to try running the app, which doesn't work out either. I just have a big grey screen that says no files are open.

5 Answers

Harry James
Harry James
14,780 Points

Hello again Jason!

Ok. I know what screen you're on when it says "No files are open". To get files open like Ben has, you can navigate to app >> java >> com.yourpackage.name >> MainActivity like I have here:


You should however, also be able to run your app. To do this, click the Run button on the top toolbar (I know, there's a lot there!). It looks like a play button:

After clicking this, you may be prompted which device you want to run your app on. Select your current emulator or open a new one if you haven't got one open yet

If you don't have any emulators yet, you can create one by clicking on the ... button on the above screen and then clicking Create Virtual Device:

After that, select the device you want to use as the emulator (I'm going to use the Nexus 6 as it's Google's latest mobile device) and then press Next:

Next, select the version of the Android SDK you want the device to run (I'm going to be running on Lollipop as, that is currently the latest SDK version) and also what ABI you wish to use (You should select the one best for your system):

  • x86 is for 32-bit processors,
  • x64 is for 64-bit processors.
  • armeabi is a generic type based on the ARM architecture and also allows the running of other types of code, like C/C++.

Click Next again and you will be presented with this final screen:

Here, give the device a name (Or keep the default). You should also check Use Host GPU as it uses your Graphics card to make the emulator run faster (Although, it still is extremely slow however, Ben will later teach you about Genymotion, a faster, third-party emulator). Finally, click Finish and you will be able to choose this emulator on the Run screen.

It will take a while for the emulator to start up but, once it has, your app should load up automatically (If not, try pressing the Run button again).

Hopefully, you'll then be able to see you app but, if not, give me a shout.


Hope it helps and, if this hasn't solved your problem yet, give me a shout :)

Jason Zwick
Jason Zwick
311 Points

Well, to begin, my Studio looks nothing like that, though I imagine that is just a fancy skin you have on. Next, I was able to get it going, and I was even able to get hello world to display on my Nexus 4 phone. Then, when I tried to repeat this again, I get two errors. I changed nothing, and I'm suddenly getting errors for something that worked a few moments ago. Once again, totally in the dark about this. I should also add that the emulator doesn't seem to want to work at all, but I don't even want to go there right now.

"Error:(7, 17) Resource id cannot be an empty string (at 'id' with value '@+id/')." "Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/jay/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1"

Harry James
Harry James
14,780 Points

Yes, sorry, I do have a skin on!

The page you're looking at is probably this but without the skin:

As for your error, it looks like somehow one of your resources is missing an ID. If you double-click on that error, it will bring you to the line where the error is.

Since you only have a TextView on the page at this stage, the ID should be this:

android:id="@+id/textView"

You'll change it later though, so it doesn't matter that much if it is different but, it can't be blank!


If you've got it working on your actual device then that's great and yes, you don't need the emulator. It's also wayyyy quicker than the emulator so, sorry for the longwinded explanation there (I just wanted to go through all of the possibilities just in-case you didn't have a device to run the app on).


Hopefully this should help but if you get another error, let me know on this post and I'll see what I can do :)

Can you post a screen shot of what you are seeing when you try to create a new project and when you are trying to run your app?

Steve.

Jason Zwick
Jason Zwick
311 Points

Okay, when I started it up again, it began to download more software. Will update if this solves the issue.

Jason Zwick
Jason Zwick
311 Points

Thanks, that did solve it. I don't know how I managed to delete that portion without realizing. Hopefully the videos will help with everything else!

Harry James
Harry James
14,780 Points

No problem!

The videos should definitely guide you through Android/Java and Ben does a great job at explaining everything.

I can see that you joined 2 days ago so, welcome to Treehouse and hope you enjoy it here :)

As always, if there's anything you don't understand or can't get your head around, post over in these forums and there'll always be someone looking around who'll (hopefully) pick up your question/problem and help you through it.


Have fun and happy coding :) *hi-five*

Jason Zwick
Jason Zwick
311 Points

Thanks very much! I'm running into another issue that I'm having trouble solving on my own, learning Java was easier than this! Haha.

Once again, I haven't edited anything (apart from what you've pointed out), but I'm getting this error;

"Rendering Problems The following classes could not be instantiated: - android.support.v7.internal.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE"

I've tried fiddling with it, but I was under the impression that this blank app would be stable on it's own. Shouldn't it only be giving me all this trouble once I start messing around with it?

Harry James
Harry James
14,780 Points

Yeah. I get problems like that now and then when I first start a project. Android Studio does have its moments sadly! This probably does put you off as a Beginner but, trust me, it gets better! Most of the issues you will have are often the start of a project/loading somebody else's project anyway.

I found usually the issue fixes itself after closing the window and open it again. If not, try these alternate fixes (Follow them in the same order until it works):


You can also try cleaning the project. To do this, click on the Build tab and then Clean Project and wait for the Clean to finish:


If you are still having issues, try Invalidating Android Studio's caches. To do this, click on the File tab then Invalidate Caches / Restart and press Invalidate and Restart:


If you are still having issues after that, paste the contents of your styles.xml file here (It's located in the res >> values directory) and I'll see if something looks wrong.

In the meantime, you could also try changing the Preview SDK Version to a different one if you've got one downloaded. To do this, on the Preview, click on the Android Icon and change the SDK Version to a different one (If you don't have another, you could download one but, I'd probably get back to you before it downloaded so it's not worth it really).


Hope it helps and if there's anything else, give me a shout :)

Jason Zwick
Jason Zwick
311 Points

Yeah, I googled it and saw that changing the SDK licks it, and that's what ended up solving the problem. Nature of the beast I suppose; Learning a language presents problems down the road, learning how to use a tool presents problems at the beginning! Thanks again.

Harry James
Harry James
14,780 Points

Yeah, it's a suitable fix for now. An alternate fix (If you still want to use API 22 for the Preview) is to fix the style it's trying to use in the styles.xml file I was talking about.

I just reproduced the problem by creating a new test app and if you change your theme to parent the Base class, it seems to fix the problem (You can delete everything in styles.xml and replace it with this to fix it):

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

Don't worry about all of the details here like what I'm doing with the themes - Ben goes through this sort of stuff in the projects. It is also completely fine to set your theme like this during the courses - In the majority, Ben will actually tell you to use a different theme (Themes allow us to change how things are styled - so colors of everything and whether we should show the action bar).