Showing posts with label android studio. Show all posts
Showing posts with label android studio. Show all posts

Tuesday, December 20, 2016

Arch Linux-Getting Started with Android Studio

In this post I am going to share my experience in setting up Android Studio IDE on Arch Linux platform.

STEP 1::

        Download Linux based Android Studio from Android Developer portal from this link to specific directory.In my case I saved in   home/Documents/Android_IDE/Android-Studio

STEP 2::
   
        Open terminal and navigate to the downloaded directory
                        
                      $ cd home/Documents/Android_IDE/Android-Studio                 

STEP 3::

        Extract the 'tar.gz' file
          $ tar -zxvf android-studio-bundle-133.1028713-linux.tgz              

STEP 4:: 
       Its time to download Java. Download Java SE from Oracle portal( Visit Oracle Java SE Download page). Extract files and voila!!!, Java is installed successfully.To verify if installed perfectly, type in terminal

                                                  $ java                                                             

If list of available commands are displayed then its done (good job!!!)
STEP 5::
Once Android Studio file extracted, navigate to bin folder
                $ cd /op/home/android-studio/bin                                        
 Start the Android Studio from the terminal
                                   $ ./studio.h                                                        
 Instead of starting Android Studio from the home directory, add the bin path to PATH environmental variable.
                $ JAVA_HOME=~/Development/jdk<version> ./studio.sh       
Hope it helped. Happy coding !!!

Wednesday, February 11, 2015

Arch Linux- Android Studio with SHA-1 fingerprint

Cheers !!!!

Using Google API's we can develop Android Applications to integrate either the location based search or maps API and so on.


Creating application for Google Maps, we have to obtain the API key from Google console and include in our code.


In this post I will brief about obtaining the fingerprint which is useful to obtain the Google Map's API Key.


STEP 1::  Launch the Android SDK Manager

               In Android Studio (I used), open the sdk manager console by clicking on the icon







. SDK manager window opens

STEP 2:: Install the Supporting Google API.
             Install Supporting Repository,Google Repository,Google Play Services from the Extras

STEP 3:: Add the Google Play services in  Gradle

              Open build.gradle  configuration file of the application and include the Google Services dependency. such as 
compile 'com.google.android.gms:play-services:4.3.23'

STEP 4:: Create Map Fragment.

              Declare option for the MapFragment by including the tag in fragment xml file:
            <fragement
                    xmlns:map="http://schemas.android.com/apk/res-auto"
               />

During this process if you encounter exception then clean the project by navigating to the project path

      
       c:/home/directory/android_projects/SampleApp> gradlew clean

In few case (including my situation) while performing this command if permission error encountered then provide the editable permission by login as admistrator in terminal and type 
            
            # chmod 777 gradlew


STEP 5:: Obtain the SHA-1 hash fingerprint using keytool

             Firstly determine the path of keytool in .android folder. Usually it is found in home folder such as
/home/.android

navigate to the path and type the command.


$ keytool -list -v -keystore debug.keystore 



Ignore if asked any password asked and just go ahead and press Enter. You will obtain the fingerprints such as


Certificate fingerprints:

MD5:  52:1E:05:92:D7:04:7F:83:D3:86:97:30:7V:3B:62:14
SHA1: 19:8V:6B:F2:2C:93:02:23:2R:8B:5F:C6:F3:63:9E:EB:5E:VB:7A:B3



SHA256: 03:9C:84:EV:6V:4A:C1:88:25:43:7R:57:A8:A1:77:EE:DA:53:CC:E6:F5:



STEP 6:: Paste key in Google Console
              Copy obtained fingerprint and paste in the Google API Console  https://code.google.com/apis/console while creating a new Android key. click save. Voila!!!! Android API key is generated.

STEP 7:: Include in our code
               In order to use the generated API key, go to our manifest file and under the activity tag where we want to use Google Map, add the meta data

       <meta-data 
               android:name="com.google.android.maps.v2.API_KEY"                            android:value="YOUR_API_KEY_HERE"
        />

Boom !!!!!! Run the code and we can see the Map displayed.... !!!!!

Happy Coding !!!!