Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlvin Lin
1,365 PointsUnable to run an Android app in Android Studio
When I click run, I get some errors and the emulator window does not show up. Here's a screenshot.
Thanks in advance.
3 Answers
Kevin Beach
1,370 PointsHi Alvin, sorry not had this particular error before. Quickly looking on the web seems to indicate it could be a number of issues, including settings in the compiler, or possibly an error in one of the xml files. I would look and see if there are issues in the xml files, especially the manifest (one person resolved the error by finding they had the package name wrong in the manifest). Have a look at StackOverflow - http://stackoverflow.com/questions/17054000/cannot-resolve-symbol-r-android-studio for some suggestions. It does look like you will need to do some digging to get to the source of the error, but I would be tempted to do a gradle clean first, you may be lucky and this will resolve the issue, otherwise I would look at all the files for errors and then start going through suggestions on threads like the one I linked above.
Kevin Beach
1,370 PointsHi Alvin. I am fairly new to Android and Android Studio, so someone might be able to help more, but I think this is an issue between 32bit and 64bit libraries if you are running Linux OS such as Ubuntu. I had a machine on Ubuntu and the same thing happened to me. I used a couple of forums which had a solution
http://askubuntu.com/questions/147400/problems-with-eclipse-and-android-sdk http://esausilva.com/2014/08/29/android-studio-error-while-loading-shared-libraries-libz-so-1/
Basically, I had to install the 32 bit libraries even though the OS was 64 bit, and it all then worked. The solutions are a little old, so not sure if this problem is still current. It is probably worth a look though.
Alvin Lin
1,365 PointsThanks for the response. I tried this but I'm still getting the same error. I tried rebuilding the project and starting from scratch as well, so I looked at why there were errors. http://snag.gy/seC0J.jpg This screenshot shows 'Cannot resolve symbol "R"' and I don't know how to fix that. Shouldn't a newly built project not have errors?
Alvin Lin
1,365 PointsI ran
sudo apt-get install lib32z1
and then rebuilt the project to fix the problem.
rp74
7,462 Pointsrp74
7,462 PointsNot positive this will work, but have you tried to rebuild and resync your gradle file under the gradle dropdown button. Also, it is more likely you will get help if you use Markdown.
P.S. nice- omgimanerd.