Objectives:
As mentioned in Online Activities page, you will use a git repository hosted on github classroom for all activities (labs and project).
Step 1. Create a github account or login on an existing one
Step 2. Use the invite link received from your Teaching Assistant during the live session
Step 3. Accept the assignment
Step 4. Refresh your page
Step 5. Click on your repository link (if you get an error, make sure you are logged in)
Step 6. Edit the readme file and add your name, master programme and any other information you consider necessary
Tip: You can edit files directly on github, which is an useful feature especially for readme files.
You should clone your repository to a local folder
The following steps can be performed in the command line, in Android Studio or in any other git source control app (e.g. SourceTree], [[https://desktop.github.com/|Github desktop]).
Useful resources:
Step 1. Clone your repo
$ git clone git@github.com:SMD-UPB/lab_20-22_adriana-adrianacd.git demo Cloning into 'demo'... remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (2/2), done. remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (5/5), done. $ cd demo $ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
Step 2. Create a new branch
$ git branch lab0 $ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean $ git branch -l lab0 * main $ git checkout lab0 Switched to branch 'lab0' $ git status On branch lab0 nothing to commit, working tree clean
Step 3. Configure .gitignore
We don't usually store generated files, compiled files etc in our repositories.
For Android, there are some IDE generated folders and files that should be ignored and not committed. You can use an existing template or the one we use for the labs snippets repository. You can add and edit the file directly on Github or create it locally and follow the next steps.
$ git add .
Step 5. Commit your changes
$ git commit -m 'Lab 0 demo'
Step 6. Push your changes
You should also have an email and username already configured. If not, you can configure using the commands shown in this guide
$ git push
For code reviews we use pull requests. Depending on the repository hosting platform, we can have different names for them, but the concept is the same: a mechanism for requesting reviews for your code. It usually shows a diff of your new changes vs the branch you want to merge your code into and it allows reviewers to submit comments, tasks and to approve/reject.
Example:
Push the changes made of the branch lab0 and then go on Github to create a Pull Request. Don't forget to add reviewers to your PR.
$ git push --set-upstream origin lab0 Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 295 bytes | 295.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for 'lab0' on GitHub by visiting: remote: https://github.com/SMD-UPB/lab_20-22_adriana-adrianacd/pull/new/lab0 remote: To github.com:SMD-UPB/lab_20-22_adriana-adrianacd.git * [new branch] lab0 -> lab0 Branch 'lab0' set up to track remote branch 'lab0' from 'origin'.
A pull request can be created in many ways. For example:
This part can take more than half an hour due to all the tools you need to download
Install on any OS you prefer the following tools:
* Install the SDK and tools
SDK - the latest one should be enough (Android 11)
Android SDK Tools and Emulator
The Android SDK Tools offer adb, which you can use to connect to your device.
Most apps can be run in an emulator (most because the emulator lacks support for some features such as Bluetooth connectivity). You can run the apps your create during the labs in an emulator or on a physical device.
Step 1. To setup a virtual device you need to access Tools → AVD Manager Step 2. Create a device
Step 3. Select a device type and system image
Activate Developer Options
Connect your device via an USB cable or configure adb via Wi-FI
When the device is connected you can see it in the run targets window:
or using the adb devices command from the CLI (make sure you add android sdk tools to your Path variable)
$ adb devices List of devices attached R58M24W63GN device
Let's create a Hello World project to try out the IDE and tools.
Explanations about these steps: Create your first project
Run the app on your physical device or in a virtual device. Press the run button
You can check the logs in the Logcat window
Extras:
Check your project's structure. More info on this page