android api

Upload: johnzipper

Post on 04-Apr-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Android API

    1/4

    How to install Android SDK on UbuntuIf you are using a 64-bit distribution of Ubuntu you need to install 32-bit libraries since Android onlyruns in 32-bit environment.Open a terminal window and execute the following command:archCheck the result for "x86_64". This means you are running a 64-bit distribution.

    In this case install 32-bit libraries by executing the following command in the terminal window:sudo apt-get install ia32-libsEnter "Y" when you are asked to continue.

    You need latest jdkDownload latest jdk and jre

    http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linuxsudo mkdir -p /usr/local/javamove your jdk and jre to above dirJAVA_HOME=/usr/local/java/jdk1.7.0_07PATH=$PATH:$HOME/bin:$JAVA_HOME/binJRE_HOME=/usr/local/java/jre1.7.0_07PATH=$PATH:$HOME/bin:$JRE_HOME/binexport JAVA_HOMEexport JRE_HOMEexport PATHsudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_07/bin/java" 1sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_07/bin/javac" 1sudo update-alternatives --set java /usr/local/java/jre1.7.0_07/bin/javasudo update-alternatives --set javac /usr/local/java/jdk1.7.0_07/bin/javacjava -versionjava version "1.7.0_07"Java(TM) SE Runtime Environment (build 1.7.0_07-b10)Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)javac -versionjavac 1.7.0_07

    INSTALL ECLIPSEExtract eclipsecd /usr/sharesudo mv ~/Downloads/eclipse /usr/sharesudo chown -R root:root/ eclipsesudo touch /usr/bin/eclipsesudo chmod 755 /usr/bin/eclipsesudo gedit /usr/bin/eclipse &Copy this into gedit:#!/bin/shexport ECLIPSE_HOME="/usr/share/eclipse"$ECLIPSE_HOME/eclipse $*Save and close gedit.Create a Gnome menu item by executing the following command in the terminal window:

  • 7/30/2019 Android API

    2/4

    sudo gedit /usr/share/applications/eclipse.desktop &Copy this into gedit:[Desktop Entry]Encoding=UTF-8Name=EclipseComment=Eclipse

    IDE Exec=eclipseIcon=/usr/share/eclipse/icon.xpmTerminal=falseType=ApplicationCategories=GNOME;Application;Development;StartupNotify=trueSave and close gedit.Note: If you get the following error when starting eclipse "JVM terminated. Exit code=13" then youhave to install the correct java version (version 5 or version 6) or you are trying to run a 32-bit versionof Eclipse on a 64-bit JVM.Install 64-bit version of eclipse in this case.

    Installing ADT (Android Development Tools) Plugin for EclipseStart Eclipse.Click on the menu bar "Help" -> "Install New Software..."Click on "Add..." at the upper right and enter the following information.Name: your eclipse version EG juno, indigo

    Location: http://download.eclipse.org/releases/version_nameClick again on "Add..." and enter the following information.Name: ADT PluginLocation: https://dl-ssl.google.com/android/eclipse/Click on "OK"In the "Available Software" dialog window, select the checkbox next to "Developer Tools" and click"Next".In the next window, you will see a list of the tools to be downloaded. Click "Next".Read and accept the license agreements and click "Finish".Note: If you get a security warning saying that the authenticity or validity of the software can't beestablished, click "OK".configure the ADT plugin restart Eclipse.A dialog window opens automatically:Choose "Use Existing SDKs", press the "Browse" button and select the "android-sdk-linux" directoryin your home directory. Press "Next" Decide on sending usage statistics or not and click "Finish"If the dialog does not open automatically:Click on the menu bar "Window"->"Preferences". Then select "Android" on the left. To select the SDKlocation click the "Browse..." button and select the "android-sdk-linux" directory in your homedirectoy. Click "Apply".Expand the "Android" tab on the left and select "Usage Stats". Decide on sending usage statistics andclick "OK" to close the window.

  • 7/30/2019 Android API

    3/4

    if adb command not found puth adb path in .bashrcexport PATH=${PATH}:~/android-sdk-linux/toolsexport PATH=${PATH}:~/android-sdk-linux/platform-tools

    Uninstalling eclipse-sdkto uninstall eclipse in ubuntu or remove storage password dispose .eclipse folder in home folder, also

    entries you mad in /usr/share directory then install eclipse again

    $ adb devices

    * daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached04C06F49C2F7 device

    $ lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hubBus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching HubBus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching HubBus 003 Device 002: ID 12d1:1038 Huawei Technologies Co., Ltd. Ideos (debug mode)Bus 001 Device 003: ID 04f2:b303 Chicony Electronics Co., LtdBus 002 Device 003: ID 0930:021d Toshiba Corp.

    we need the highlighted line aboveProduct ID then vendor(PID:VID) ie 12d1:1038mode is the permission$ sudo gedit /etc/udev/rules.d/51-android.rules

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="12d1", MODE="0666"

    the above rule is for google ideos U8150-Dsudo restart udevadb devices$ adb kill-server$ adb start-server

  • 7/30/2019 Android API

    4/4

    DEbug keyin Eclipse, select Windows > Prefs > Android > Build to check the full path of your debugkeystore

    cd to folder where your .keystore file is stored

    keytool -list -v -alias androiddebugkey -keystore /home/brice/.android/debug.keystore -storepass

    android -keypass android

    we need the fingerprint in md5(thats why we added -v (verbose) in above line

    Go to below URL and create your keys

    https://developers.google.com/android/maps-api-signup

    Release key

    mkdir release_keyscd release_keys

    sign your appfile export export android applicationcreate new keystorecreate md5 fingerprint

    keytool -list -v -alias gps -keystore gps.keystorealias is the alias you created earlier, also keystore is the keystore from earlier

    create api keyssign your application again using existing keystore which you created earlier