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 :)

Thursday, July 28, 2016

Android Debugging

Two great ways to debug better. Happy testing.

1. In Android Studio add font color to logcat.

  • How to add color font to logcat follow the below steps:
  1.  Open Android Studio
  2. Preferences -> Editor -> Colors & Fonts -> Android Logcat.
  3. Click button ‘Save As’, and name your new Scheme. (uncheck ‘Use inherited attributes’)
  4. In the right side select a color for each component: Assert, Debug, Error, Info, Verbose, Warning.



2. Add color to terminal adb logcat.
  • Take a look at this tool from Jake Wharton pidcast:
Easy to use.
Install: $brew install pidcat
Use: $adb logcat -v brief | pidcat com.myPackage.Name 

Third party tool optioon: Mac tool LogRabbit  http://lograbbit.com $10


Let me know if you have any questions.

Thursday, July 21, 2016

Update Android SDK and Tools from terminal

1. Open Terminal and type below commands.

Opens Android SDK Manager UI. (same as
$android

Software available to update
$android list sdk -a

Install software
$android update sdk -a -u -t #
$enter 'y' to accept license

-----------------------------------------
Example
$android list sdk -a

outputs:
140- GPU Debugging tools, revision 3.1
141- GPU Debugging tools, revision 1.0.3
142- Android Support Repository, revision 34

We want to update "Android Support Repository, revision 34".
we need to use below command:
$android update sdk -a -u -t 142
$enter 'y' to accept license 
Done command installs Android Support Repository, revision 34 :)

 

Wednesday, July 20, 2016

In Android Studio 2.2 gradlew command can donwload android.sdk dependencies


For more info watch video from GoogleIO 2016 What's new in Android Development tools (min 11:55-12:15)


Gradle Build System release notes

Add to gradle.properties:
android.builder.sdkDownload=true

According to this post:
Command will only download android sdk, it will not download google service, repository etc..