Troubleshooting Guide Developing Android Apps in Kotlin
Troubleshooting Guide Developing Android Apps in Kotlin
Kotlin
You can download the latest stable version of Android Studio here.
In our courses, we strive to teach the most up-to-date features when a course is released. While
a course is being developed, these features may still be under development, and instructors
may be using beta or canary versions of Android Studio. Note that as a result, the UI shown in
the videos may be slightly different from the UI you are working with.
If you need to download and install a beta or canary build, you can find links to them here.
For this course, we recommend that you use the latest stable version, unless a feature used in
the course is not yet released in stable.
There are four different preview channels, described below. See the Preview Channels
documentation for details.
■ Stable channel: Contains the most recent stable version of Android Studio.
■ Beta channel: When Android Studio reaches a beta milestone for its next version, the
beta builds are posted here.
■ Dev channel: Dev builds are hand-picked older canary builds that survived the test of
time. The channel should be updated roughly bi-weekly or monthly.
■ Canary channel: Canary builds are the bleeding edge, released about weekly. While
these builds do get tested, they are still subject to bugs, as the Android team wants
people to see what's new as soon as possible. This build is not recommended for
production development.
● We recommend that you use a local Git installation to work with your code, and you can
find details below.
● If you choose not to use Git for your projects, you find instructions below for downloading
the code as a zip file from GitHub.
We recommend that you create an account on GitHub and use it for this course. In addition to
keeping your exercises organized, your GitHub repositories can eventually serve as your coding
and project portfolio.
How to use this repo while taking the course describes the structure of our repository and how
you can find solutions to lesson exercises.
Import Lesson Code into Android Studio
7. Paste the HTTPS web URL that you copied a few steps ago into the URL field.
8. Choose a location for the local repository and click the Clone button.
9. Click Yes when prompted to open the project.
10. Click OK when prompted to Import from gradle.
11. Click Don't remind me again for this project if prompted to update gradle files.
12. Wait until the build finishes.
○ If you get error messages about missing components, click the links in the
messages to install the required components for your project. This may take a
while.
1. Click Version Control at the bottom of Android Studio to open a pane that shows all the
branches and their relationships.
○ If you don't see it, select View > Tool Windows > Version Control to show it.
2. Click on the Git button at the bottom right of Android Studio. This will show you all the
branches.
● Local branches are branches you have cloned to your local Git repository.
● A yellow tag indicates which branch you're currently on.
● The name of the current branch is also always visible in the lower right corner.
● Remote Branches is the list of all available branches for this project.
● Commits for all course projects are organized as Exercise-Solution pairs,
providing you with a clean start and the instructor's solution for each exercise.
4. Click OK. The branch is checked out and the code is opened in Android Studio.
● Locally, through Git, or by downloading the corresponding solution branch as a zip file.
● On GitHub, you can view a branch by clicking the Branch button and selecting the
branch from the dropdown box.
● The source code for each exercise has the starting code and the solution code, as
shown in the previous screenshot.
● The starter code for each step includes a set of TODOs to guide you through the
changes that you need to make for that exercise.
1. Open the TODO pane to display a complete list of the TODOs you complete for every
step.
2. Each TODO indicates a place in the code where you will need to make changes.
3. Double clicking a TODO opens the file and takes you directly to its place in the code.
Sometimes you'll be given extra information or tips in the TODOs, so make sure to read
each one carefully.
Looking at Udacity solution code on GitHub
If you get stuck on an exercise or want to check if you did the right thing, you can look at the
difference between the starter and solution code.
1. On GitHub click the button that shows the number of commits (toward the upper left of
the screen).
2. The next screen lists all the commits for the current branch. Click on a commit to view all
the changes made since the prior commit.
3. Clicking on the commit will open a page showing the differences. This can be in split,
side-by-side, or as a unified view. Click the corresponding button in the upper right
corner of the page to change this view.
5. See the GitHub documentation for detailed instructions for reading diff screens.
1. Click Version Control to open the Version Control pane with a list of branches.
2. Select a solution commit. For example, the Step 1 solution branch will be called
"Step.01-Solution-Followed-by-a-description" .
4. The diff window presents the two commits side-by-side and highlights the differences
between them. You can see the code that was added to fulfill the TODOs.
Updates
Android Studio will alert you when any of Udacity projects' Gradle version is out-of-date, when
you open a project with an outdated version.
● If you choose to update to a newer version, there is no guarantee that your code will
work as expected, although it typically will.
Dependencies updates
Android Studio alerts you when dependencies are out-of-date by highlighting them in the
build.gradle file during editing.
We recommend that you do NOT update dependencies, unless absolutely necessary.
● Updating dependencies and Android versions can lead to issues and incompatibilities.
● If a code or dependency update is necessary, follow the course instructor's instructions.
Debugging
The Android documentation contains detailed instructions on how to debug in Android Studio.
Getting Help
If you need more help, there are many excellent resources on the web for you to explore.
● Android documentation: The main access point for complete, up-to-date, and
searchable Android documentation is https://developer.android.com. We encourage you
to explore and search this resource.
● Tutorials are a great resource for learning new features or enhancing your Android
knowledge. Search for a topic and "tutorial" to find them.
● StackOverflow is where the developer community at large, representing all skill levels,
post questions and answers on a wide range of topics. If you’re struggling with an issue,
chances are someone else has already encountered and solved it.
● Udacity courses: And don’t forget, you can find additional Android courses on
udacity.com.