3 Jul 2013

How to use Proguard in Android

How to use Proguard in Android
As an Android developer, when you create an application you have to keep in mind to protect your source code.
As you put apk in the market, anyone can  get the code from the apk. They can miss-use the code and key-functionalities of your app(think, if the app has payment transactions or such secure information).
Android provides “proguard” tool, which helps to safe your source code.
It is easy to implement the proguard in your android app.
Below are the steps which you should follow to use proguard(In eclipse 3.6.2).

Step 1: Enabling Proguard
In your android project, see the file project.properties.
Add the following line in that file
proguard.config=proguard.cfg (its default location of file)
If you have moved the location of file then give absolute path as,
proguard.config=/path/to/proguard.cfg

Step 2: Configuring Proguard
For some situations, the default configurations in the proguard.cfg file will suffice. However, many situations are hard for ProGuard to analyze correctly and it might remove code that it thinks is not used, but your application actually needs.
To avoid errors when proguard strips away your code, and your class is declared
in manifest use following line :
- keep public class className
If you have included external jar files in 'libs' folder then proguard may give
you some error like duplicate entries in MANI.MF file / other errors.

For that it will be better option if we use 'lib' folder to keep all external jar files.
Specify all external jars separately using -injars lib.
Example of how your cfg file will look like below:
-injars lib -libraryjars ../../..//Android/android_sdk_mac_x86/add-ons/addon-google_apis-google-16 -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -dontnote -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -dontwarn sun.misc.Unsafe, java.lang.management.ManagementFactory,
org.codehaus.jackson.JsonParser, org.json.JSONObject, org.codehaus.jackson.JsonGenerator,
org.codehaus.jackson.JsonFactory, com.google.common.collect.MinMaxPriorityQueue -keep public class * extends android.app.Application -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * {     native; } -keepclasseswithmembers class * {     public(android.content.Context, android.util.AttributeSet); }  -keepclasseswithmembers class * {     public(android.content.Context, android.util.AttributeSet, int); }  -keepclassmembers class * extends android.app.Activity {    public void *(android.view.View); }  -keepclassmembers enum * {     public static **[] values();     public static ** valueOf(java.lang.String); }  -keep class * implements android.os.Parcelable {   public static final android.os.Parcelable$Creator *; }
To troubleshoot the error while compiling the proguard refer,
http://proguard.sourceforge.net/index.html#manual/troubleshooting.html

Step 3: Export the apk file.
for reference use following link -
http://developer.android.com/tools/help/proguard.html

How to view the code from apk
To check how our source code will look from the apk once proguard is added
below steps are useful.
Step 1. Change the extension of apk from apk to zip. 
Step 2. Unzip the zip file.You will see files including android_manifest.xml ,
assets, classes.dex etc.
Step 3. Download dex2jar from  http://code.google.com/p/dex2jar/wiki/UserGuide
Follow the steps given there to run dx2jar command.
Step 4. It will create classes.jar file. To view all contents of jar file use Java
Decompiler.
 (http://java.decompiler.free.fr/?q=jdgui)

23 Jun 2013

Make a pendrive bootable without software......

Hello friends, in this post, i will show you how to make your pendrive bootable to install Windows Vista/7 and 8 using only Command Prompt. Follow the tsep by step tutorial below:

1. Insert your USB (4GB+ preferable) stick to the system and backup all the data from the USB as we are going to format the USB to make it bootable.

2. Open elevated Command Prompt. To do this, type in CMD in Start menu search field and hit Ctrl + Shift + Enter. Alternatively, navigate to Start > All programs >Accessories > right click on Command Prompt and select run as administrator.

3. When the Command Prompt opens, enter the following commands:


DISKPART and hit enter.

LIST DISK and hit enter.

Once you enter the LIST DISK command, it will show the disk number of your USB drive. In the below image my USB drive disk no is Disk 1.

4. In this step you need to enter all the below commands one by one and hit enter. As these commands are self explanatory, you can easily guess what these commands do.

SELECT DISK 1 (Replace DISK 1 with your disk number)

CLEAN

CREATE PARTITION PRIMARY

SELECT PARTITION 1

ACTIVE

FORMAT FS=NTFS

(Format process may take few seconds)

ASSIGN

EXIT

all keyboard shortcuts...

All keyboard Shortcuts

Windows Shortcuts

    Shift + F10 right-clicks.

    Win + L (XP Only): Locks keyboard. Similar to Lock Workstation.

    Win + F or F3: Open Find dialog. (All Files) F3 may not work in some applications which use F3 for their own find dialogs.

    Win + Control + F: Open Find dialog. (Computers)

    Win + U: Open Utility Manager.

    Win + F1: Open Windows help.

    Win + Pause: Open System Properties dialog.

    Win + Tab: Cycle through taskbar buttons. Enter clicks, AppsKey or Shift + F10 right-clicks.

    Win + Shift + Tab: Cycle through taskbar buttons in reverse.

    Alt + Tab: Display Cool Switch. More commonly known as the AltTab dialog.

    Alt + Shift + Tab: Display Cool Switch; go in reverse.

    Alt + Escape: Send active window to the bottom of the z-order.

    Alt + Shift + Escape: Activate the window at the bottom of the z-order.

    Alt + F4: Close active window; or, if all windows are closed, open shutdown dialog.

    Shift while a CD is loading: Bypass AutoPlay.

    Shift while login: Bypass startup folder. Only those applications will be ignored which are in the startup folder, not those started from the registry (Microsoft\Windows\CurrentVersion\Run\)

    Ctrl + Alt + Delete or Ctrl + Alt + NumpadDel (Both NumLock states): Invoke the Task Manager or NT Security dialog.

    Ctrl + Shift + Escape (2000/XP ) or (Ctrl + Alt + NumpadDot) : Invoke the task manager. On earlier OSes, acts like Ctrl + Escape.

    Print screen: Copy screenshot of current screen to clipboard.

    Alt + Print screen: Copy screenshot of current active window to clipboard.

    Ctrl + Alt + Down Arrow: Invert screen. Untested on OS's other than XP.

    Ctrl + Alt + Up Arrow: Undo inversion.

    Win + B : Move focus to systray icons.


General


    Ctrl + C or Ctrl + Insert: Copy.

    Ctrl + X or Shift + Delete: Cut.

    Ctrl + V or Shift + Insert: Paste/Move.

    Ctrl + N: New... File, Tab, Entry, etc.

    Ctrl + S: Save.

    Ctrl + O: Open...

    Ctrl + P: Print.

    Ctrl + Z: Undo.

    Ctrl + A: Select all.

    Ctrl + F: Find...

    Ctrl+W : to close the current window

    Ctrl + F4: Close tab or child window.

    F1: Open help.

    F11: Toggle full screen mode.

    Alt or F10: Activate menu bar.

    Alt + Space: Display system menu. Same as clicking the icon on the titlebar.

    Escape: Remove focus from current control/menu, or close dialog box.


General Navigation


    Tab: Forward one item.

    Shift + Tab: Backward one item.

    Ctrl + Tab: Cycle through tabs/child windows.

    Ctrl + Shift + Tab: Cycle backwards through tabs/child windows.

    Enter: If a button's selected, click it, otherwise, click default button.

    Space: Toggle items such as radio buttons or checkboxes.
                                               
    Alt + (Letter): Activate item corresponding to (Letter). (Letter) is the underlined letter on the item's name.

    Ctrl + Left: Move cursor to the beginning of previous word.

    Ctrl + Right: Move cursor to the beginning of next word.

    Ctrl + Up: Move cursor to beginning of previous paragraph. This and all subsequent Up/Down hotkeys in this section have only been known to work in Rich Edit controls.

    Ctrl + Down: Move cursor to beginning of next paragraph.

    Shift + Left: Highlight one character to the left.

    Shift + Right: Highlight one character to the right.

    Shift + Up: Highlight from current cursor position, to one line up.

    Shift + Down: Highlight from current cursor position, to one line down.

    Ctrl + Shift + Left: Highlight to beginning of previous word.

    Ctrl + Shift + Right: Highlight to beginning of next word.

    Ctrl + Shift + Up: Highlight to beginning of previous paragraph.

    Ctrl + Shift + Down: Highlight to beginning of next paragraph.

    Home: Move cursor to top of a scrollable control.

    End: Move cursor to bottom of a scrollable control.


File Browser

    Arrow Keys: Navigate.

    Shift + Arrow Keys: Select multiple items.

    Ctrl + Arrow Keys: Change focus without changing selection. "Focus" is the object that will run on Enter. Space toggles selection of the focused item.

    (Letter): Select first found item that begins with (Letter).

    BackSpace: Go up one level to the parent directory.

    Alt + Left: Go back one folder.

    Alt + Right: Go forward one folder.

    Enter: Activate (Double-click) selected item(s).

    Alt + Enter: View properties for selected item.

    F2: Rename selected item(s).

    Ctrl + NumpadPlus: In a Details view, resizes all columns to fit the longest item in each one.

    Delete: Delete selected item(s).

    Shift + Delete: Delete selected item(s); bypass Recycle Bin.

    Ctrl while dragging item(s): Copy.

    Ctrl + Shift while dragging item(s): Create shortcut(s).

    In tree pane, if any:

    Left: Collapse the current selection if expanded, or select the parent folder.

    Right: Expand the current selection if collapsed, or select the first subfolder.

    Numpad Asterisk: Expand currently selected directory and all subdirectories. No undo.

    Numpad Plus: Expand currently selected directory.

    Numpad Minus: Collapse currently selected directory.


Accessibility

    Right Shift for eight seconds: Toggle FilterKeys on and off. FilterKeys must be enabled.

    Left Alt + Left Shift + PrintScreen: Toggle High Contrast on and off. High Contrast must be enabled.

    Left Alt + Left Shift + NumLock: Toggle MouseKeys on and off. MouseKeys must be enabled.

    NumLock for five seconds: Toggle ToggleKeys on and off. ToggleKeys must be enabled.

    Shift five times: Toggle StickyKeys on and off. StickyKeys must be enabled.

    6.) Microsoft Natural Keyboard with IntelliType Software Installed

    Win + L: Log off Windows.

    Win + P: Open Print Manager.

    Win + C: Open control panel.

    Win + V: Open clipboard.

    Win + K: Open keyboard properties.

    Win + I: Open mouse properties.

    Win + A: Open Accessibility properties.

    Win + Space: Displays the list of Microsoft IntelliType shortcut keys.

    Win + S: Toggle CapsLock on and off.


Remote Desktop Connection Navigation



    Ctrl + Alt + End: Open the NT Security dialog.

    Alt + PageUp: Switch between programs.

    Alt + PageDown: Switch between programs in reverse.

    Alt + Insert: Cycle through the programs in most recently used order.

    Alt + Home: Display start menu.

    Ctrl + Alt + Break: Switch the client computer between a window and a full screen.

    Alt + Delete: Display the Windows menu.

    Ctrl + Alt + NumpadMinus: Place a snapshot of the entire client window area on the Terminal server clipboard and provide the same functionality as pressing Alt + PrintScreen on a local computer.

    Ctrl + Alt + NumpadPlus: Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PrintScreen on a local computer.


Mozilla Firefox Shortcuts

    Ctrl + Tab or Ctrl + PageDown: Cycle through tabs.

    Ctrl + Shift + Tab or Ctrl + PageUp: Cycle through tabs in reverse.

    Ctrl + (1-9): Switch to tab corresponding to number.

    Ctrl + N: New window.

    Ctrl + T: New tab.

    Ctrl + L or Alt + D or F6: Switch focus to location bar.

    Ctrl + Enter: Open location in new tab.

    Shift + Enter: Open location in new window.

    Ctrl + K or Ctrl + E: Switch focus to search bar.

    Ctrl + O: Open a local file.

    Ctrl + W: Close tab, or window if there's only one tab open.

    Ctrl + Shift + W: Close window.

    Ctrl + S: Save page as a local file.

    Ctrl + P: Print page.

    Ctrl + F or F3: Open find toolbar.

    Ctrl + G or F3: Find next...

    Ctrl + Shift + G or Shift + F3: Find previous...

    Ctrl + B or Ctrl + I: Open Bookmarks sidebar.

    Ctrl + H: Open History sidebar.

    Escape: Stop loading page.

    Ctrl + R or F5: Reload current page.

    Ctrl + Shift + R or Ctrl + F5: Reload current page; bypass cache.

    Ctrl + U: View page source.

    Ctrl + D: Bookmark current p

Comments

© 2013-2016 ITTechnocrates. All rights resevered. Developed by Bhavya Mehta