- Branch
- GitLab and SSH keys
- Basic commands
- Android Setup
- Git Basic Commit History
- Gradle Project Structure
- How I organize Android project structure
- Package by features, not layers
- Best practices in Android development by Futurice developers
- Code Style for Contributors
- Architecture Guidelines
- Android MVP Architecture: Sample App
- Google Java Style Guide
- A successful XML naming convention
- Refactoring & Design Patterns
- Display and control your Android device
- Android interview questions
- Java Interview questions
- Kotlin Interview Questions
-
Make sure GitLab account connected
-
Go to your computer's shell and type the following command :
git clone {URL_GIT} || {URL_HTTPS}
README.md
- should be created in the project root
- should be written in English
- should be written using markdown
- Open terminal using
Ctrl + T - Find emulator or devices want to logcat
adb devices
- Note the emulator or devices id
- Start logcat using this command
adb -s {DEVICE_ID} logcat
- Go to your computer's shell and type the following command :
git branch NAME_OF_BRANCH
- If you want to create new branch after creating new brach, switch to new branch
git checkout -b NAME_OF_BRANCH
- If you want to change current branch then following command :
git checkout NAME_OF_BRANCH
- If you merge to another branch then following command :
git merge NAME_OF_BRANCH
git branch --merged | grep -v \* | xargs git branch -D
- To add new remote
git remote add {REMOTE_NAME} {URL_HTTPS} || {URL_GIT}
- After set new remote, view your remote properties :
git remote -v
- Pull from remote repositories to get all changes
git pull origin NAME_OF_BRANCH
- Fetch data from remote
get checkout --track {REMOTE_NAME}/{NAME_OF_BRANCH}
- Commit history
git log
- Which is show the difference introduced in each commit
git log -p
-
Description of output
- %s Subject
- %ar Author date, relative
- %h Commit hash
- %an Author name
- %ad Author date
- %cn Comitter name
- Example code line :
git log --pretty=format:"%cn %ar"
- To add and commit all local changes in one command :
git add .
git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT"
- Also if you want to push commit changes following command line :
git push {REMOTE_NAME} {NAME_OF_BRANCH}
- Note: Check this and learn how to write a proper commit message
- Before rebase make sure feature branch and master is up to date
- This sample rebase master into feature branch
git checkout master
git pull
- After update master branch now get back feature branch
git checkout {FEATURE_BRANCH_NAME}
git rebase -i master
- After this command if two branches has conflict before push resolve the conflicts
git push --f {REMOTE_NAME} {NAME_OF_BRANCH}
- Note: Check this and learn how to rebase
git clean -d -f
- Before start make sure unpushed commit have it
- Check your branch status
git status
- After the result you can obtain your commit id or you can show how many commit ahead in current branch
git reset --hard HEAD~[NUMBER]|[COMMIT_ID]
- Before start make sure unpushed commit have it
- If you want to delete local branch type the following command
git branch -d {NAME_OF_BRANCH}
- If you want to delete remote branch type the following command
git push origin -delete {NAME_OF_BRANCH}
- Open the terminal and type this command
keytool -genkey -v -keystore {KEYSTORE_FILE_NAME}.keystore -alias {ALIAS_NAME} -keyalg RSA -keysize 2048 -validity 10000
- After this command terminal wants to more information about who create this file and company name
- Answer the questions
- Create uniq key password and store password
- Don't forget the password after created file you will use
- Move the keytool file inside the /project/app folder
- In your app.gradle file you need to replace keytool file and passwords
signingConfigs {
debug {
storeFile file("{KEYSTORE_FILE_NAME}.keystore")
keyAlias "{ALIAS_NAME}"
keyPassword "{KEY_PASSWORD}"
storePassword "{STORE_PASSWORD}"
}
}- Sync gradle file
- Now you can check your build variant on left bottom side bar in Android Studio
- You will see the all variants, select one of them and build your apk
- Go to your apk file location
- Extract apk file, open terminal in apk location and use this command :
unzip {APK_NAME} -d {UNZIP_FILE_NAME}
- Go to /META-INF/ANDROID_.RSA file (this file may also be CERT.RSA, but there should only be one .RSA file).
- Use command :
keytool -printcert -file ANDROID_.RSA
- After this command you can get fingerprints
- First install the http-server
sudo npm install -g http-server
- After installed http server create new folder
- Create new .json file inside the folder
- {FILE_NAME}.json and add json text inside the document
- Start http server using this command
http-server .
- '.' means is read all file inside the folder
- Http server will start on localhost
- First connect device through usb
- Open terminal and set port, follow this command :
adb tcpip 5555
- Now you can listen 5555 port while same network
- You don't need to connect with usb
- Now connect to device via network
adb connect {DEVICE_INTERNAL_IP:PORT_NUMBER}
- Go to your computer's shell and type the following command :
- Mail adresses should be same as GitLab mail address
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
- Locating an existing SSH key
- You can copy sha key to clipboard for Windows
notepad ~/.ssh/id_rsa.pub
- For OS
pbcopy < ~/.ssh/id_rsa.pub
type %userprofile%\.ssh\id_rsa.pub
-
Open GitLab click on your Avatar and go to your Profile Settings
-
Navigate to SSH keys
-
Paste your SSH key to Box
-
Give title description
-
Final step is click to Add Key, also you can see fingerprint
- Go to your computer's shell and type the following command :
- Mail adresses should be same as GitLab mail address
- If you have SSH key then locate existing SSH key :
cat ~/.ssh/id_rsa.pub
- If you see string starting with ssh-rsa you already have SSH key, if not you have to generate new SSH key follow the next step
- Generating new SSH Key
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
-
Open GitLab click on your Avatar and go to your Profile Settings
-
Navigate to SSH keys
-
Paste your SSH key to Box
-
Give title description
-
Final step is click to Add Key, also you can see fingerprint
- If you haven't install Android Studio follow the steps :
- Go to Android site, dowload latest version Android Studio
- Setup android-studio-ide.exe
-
Non-public, non-static field names start with m.
-
Static field names start with s.
-
Other fields start with a lower case letter.
-
Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.
public class MyClass {
public static final int SOME_CONSTANT = 42;
public int publicField;
private static MyClass sSingleton;
int mPackagePrivate;
private int mPrivate;
protected int mProtected;
}- If you haven't install Android Studio follow the steps :
- Go to Android site, dowload latest version Android Studio
- Unpack the .zip file you downloaded
- Open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh.
- Select whether you want to import previous Android Studio settings or not, then click OK.
- If you haven't install Android Studio follow the steps :
- Go to Android site, dowload latest version Android Studio
- Launch the Android Studio DMG file.
- Drag and drop Android Studio into the Applications folder, then launch Android Studio.
- Select whether you want to import previous Android Studio settings, then click OK.
- The Android Studio Setup Wizard guides you though the rest of the setup, which includes downloading Android SDK components that are required for development.
- After setup Android Studio follow the steps below :
- Open SDK Manager from Android Studio, click Tools>SDK Manager or click SDK Manager
in the toolbar - Select API 27 and API 19
- After select SDK platform click SDK Tools
- Must be select Google Play services, Android SDK Build Tools, Android Emulator and Android SDK platform Tools
- After selected items click Apply and Ok close window
- Open SDK Manager from Android Studio, click Tools>SDK Manager or click SDK Manager
- This links will convert your .svg file to vector image
