Thursday, May 4, 2017

Install Google Play Store on Android emulator (using Mac)

After successfully setting up Android Studio and creating a virtual device(android emulator), follow below steps:

A. Download Gapps make selection according to your selected device.
                                                       Ex: using Nexus 6 - API 25 - x86
1. Extract files
$unzip open_gapps-x86-7.1-micro-20170504.zip

$cd Core

2. Install lzip
$brew install lzip

3. Inside /Core extrat files from vending-all.tar.lz
$lzip vending-all.tar.lz

4. Copy Phonesky.apk to home directory
$cp vending-all/240-320-480/priv-app/Phonesky/Phonesky.apk ~/


B. Now Start emulator to push the above Phonesky.apk
1. Start your Android emulator
$./android-sdk/tools/emulator @YourDeviceName -writable-system

2. Open new terminal
$cd ~/android-sdk/platfrom-tools

3. Enter to device's shell
$adb shell
$su

4. Check where directory is mounted
$cat /proc/mounts|grep system

5. Remount
$mount -o rw,remount /dev/block/vda /system
logout shell by clicking Ctrl+d (twice)

6. Push apk
$adb root
$adb push ~/Phonesky.apk /system/priv-app/


7. Restart emulator
./adb shell stop
./adb shell start

Done, now open Google Play Store on your emulator and sign-in.




Reference:
http://linuxoidchannel.blogspot.com/2017/01/how-to-install-google-play-store-on.html

Monday, May 1, 2017

Edit ~/.bash_profile to add shortcuts

 steps:
  1. Open Terminal
  2. $vi ~/.bash_profile
  3. Add below:
  4. alias ll='ls -l'
    alias f='find . -name '
    alias subl='open -a "Sublime Text"'
  5. Done. 
 Open new terminal enter ll

Change Terminal text color

steps:
  1. Open Terminal
  2. $vi ~/.bash_profile
  3. Add below:
  4. export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
    export CLICOLOR=1
    export LSCOLORS=ExFxBxDxCxegedabagacad
    alias ls='ls -GFh'
  5. Done. Open new terminal now you have color text, 
enter $ls -l

Wednesday, March 15, 2017

Open terminal from any Mac folder

1. Go to System Preferences and select Keyboard > Shortcuts > Services. 
2. check box  "New Terminal at Folder"
3. Done. Now right click in a folder -> services -> open "New Terminal at Folder"

















reference:
lifehacker

Friday, December 9, 2016

Android Signature scheme v2

What's new in Android security N...
DroidCon London 2016 conference video 

In Android Studio 2.2+ and gradle 2.2.0+ Google adds APK signature scheme v2 to combat unauthorized modifications to apk files. It improves apk’s verification speed and detects unauthorized changes.
More info jira:
To enable add flag v2SigningEnabled true in build.gradle (Module: app)
 android {
    ...
    defaultConfig { ... }
    signingConfigs {
      release {
        storeFile file("myreleasekey.keystore")
        storePassword "password"
        keyAlias "MyReleaseKey"
        keyPassword "password"
        v2SigningEnabled true
      }
    }
  }

To verified that the apk is sign with scheme v2 you need an android device running "Android N". Use below command, if output is =1 it was sign with signature v1 and if output is =2 means it was sign with signature v2.
$ adb shell pm dump myPackageName | grep apkSigningVersion



Security feature it's only supported in Android N. Once Android N becomes popular it will be good to turn on the flag to enable signature scheme v2.

"Google signature PR commit":
(scrrenshot below)

Make signapk sign using APK Signature Scheme v2.

APKs are now signed with the usual JAR signature scheme and then
with the APK Signature Scheme v2.

APK Signature Scheme v2 is a whole-file signature scheme which aims
to protect every single bit of the APK as opposed to the JAR signature
scheme which protects only the names and uncompressed contents of ZIP
entries.

The two main goals of APK Signature Scheme v2 are:
1. Detect any unauthorized modifications to the APK. This is achieved
   by making the signature cover every byte of the APK being signed.
2. Enable much faster signature and integrity verification. This is
   achieved by requiring only a minimal amount of APK parsing before
   the signature is verified, thus completely bypassing ZIP entry
   decompression and by making integrity verification parallelizable
   by employing a hash tree.


Android Source code explain

Read this http://elinux.org/Master-android :)