I am currently working on Udacity's Android Basics Nanodegree and today I submitted the first project. The coding part of the first project was relatively easy for me, but I ran into some other complications.
First, I kept getting this message: "Gradle build finished with 2 error(s) ... " I asked for help and it was suggested that I invalidate the cache and restart. I tried that and had no luck. I shared the code on GitHub and it ran just fine on someone else's computer.
If it was not the code and not the cache, was it Android Studio or some related software causing the issue? There was a prompt in Android Studio asking me to update. I decided to try it. One update led me to a prompt for another update and when it was all done, my app worked! I was so happy and felt like such a genius for figuring out what was wrong myself!
Of course, there is always another issue around the corner. I went to try to submit my project on Udacity and the instructions required the project to be cleaned first. The screenshots they provided to show the students how to do this showed a Gradle tab that I did not have available on Android Studio.
I tried to improvise and just use the "Clean Project" option under "Build" on the menu. My project still had too many files. I tried to doing a web search on the Gradle plugin to see if I had to install something else to get the Gradle window. The web search was not helpful.
Finally, I saw a small little search button on the top right corner of Android Studio and searched for "gradle." I found both the Gradle window and the Gradle Console. "Success!" I thought. Sadly, not quite yet. I ran into another issue.
There was supposed to be a "clean" option in this Gradle window. There was a "cleanBuildCache" option, but no clean option. The screenshot in the Udacity instructions showed both "clean" and "cleanBuildCache" so I deduced that they were not the same thing. I did a web search and this time it was helpful. I found a similar question on Stack Overflow and the solution was to add this line to the build.gradle file:
I tried this and it worked! I was able to clean the project and zip it and successfully submit it on Udacity.
I have a version of this project on GitHub: https://github.com/rinita1000/udacityAndroidBasicsProjectOne
Thanks for reading!