Skip to content

abdlkdrisiktan/Android-Wiki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android-Wiki

How to import project

  • Make sure GitLab account connected

  • Go to your computer's shell and type the following command :

git clone {URL_GIT} || {URL_HTTPS}

README file properties

README.md

  • should be created in the project root
  • should be written in English
  • should be written using markdown

Display logcat via terminal

  • 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

How to create new branch

  • Go to your computer's shell and type the following command :
git branch NAME_OF_BRANCH

How to create new branch and switch new branch

  • If you want to create new branch after creating new brach, switch to new branch
git checkout -b NAME_OF_BRANCH

How to change current branch

  • If you want to change current branch then following command :
git checkout NAME_OF_BRANCH

How to merge one branch to another

  • If you merge to another branch then following command :
git merge NAME_OF_BRANCH

Delete all unmerged local branches

git branch --merged | grep -v \* | xargs git branch -D 

How to add a remote repo

  • To add new remote
git remote add {REMOTE_NAME} {URL_HTTPS} || {URL_GIT}
  • After set new remote, view your remote properties :
git remote -v

How to pull from remote

  • Pull from remote repositories to get all changes
git pull origin NAME_OF_BRANCH

How to fetch from remote

  • Fetch data from remote
get checkout --track {REMOTE_NAME}/{NAME_OF_BRANCH}

How to display log history

  • 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"
    

How to commit changes

  • 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

How to rebase one branch to another

  • 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

Delete remove and changes file

git clean -d -f

How to reset commit

  • 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]

How to delete local or remote branch

  • 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}

Create keytool file for signing apk

  • 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

Extract sha key from 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

Create static web server for the get http request

  • 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

Deploy apk remotely

  • 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}

GitLab and SSH key for Command Prompt

  • 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

alt text

  • Give title description

  • Final step is click to Add Key, also you can see fingerprint

GitLab and SSH key for Linux / macOS

  • 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

alt text

  • Give title description

  • Final step is click to Add Key, also you can see fingerprint

Install Android Studio on Windows

  1. If you haven't install Android Studio follow the steps :
  • Go to Android site, dowload latest version Android Studio
  • Setup android-studio-ide.exe

Follow Field Naming Conventions

  • 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;
}

Install Android Studio on Linux

  1. 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.

Install Android Studio on MacOS

  • If you haven't install Android Studio follow the steps :
  • 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.

Project Configuration

  • After setup Android Studio follow the steps below :
    • Open SDK Manager from Android Studio, click Tools>SDK Manager or click SDK Manager alt text 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

Android SVG to Vector Image

  • This links will convert your .svg file to vector image

About

Android-Wiki

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published