Thursday, May 14, 2015

[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.] Error: /Users/Naushad/IonicProjects/IonicApp/platforms/android/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:766:16) at Process.ChildProcess._handle.onexit (child_process.js:833:5)


sudo ionic build android

[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
Error: /Users/Naushad/IonicProjects/IonicApp/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)

to solve this i use following steps in terminal :

sudo chown -R Naushad /usr/local/lib/node_modules/cordova

still have same error than i do follwing step

export PATH=$PATH:/users/Naushad/android-sdks/tools
 then i got below error  :)
[Error: Please install Android target: "android-22".

Hint: Open the SDK manager by running: /users/Naushad/android-sdks/tools/android
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
Error: /Users/Naushad/IonicProjects/IonicApp/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)

then  I goto my Android sdk manager and update my android-22 and bam!! its work :)
Now I can build my ionic app for android :)

:preDexDebug
:dexDebug
:processDebugJavaRes UP-TO-DATE
:validateDebugSigning
:packageDebug
:zipalignDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

In short you need these two commands

sudo chown -R Naushad /usr/local/lib/node_modules/cordova

export PATH=$PATH:/users/Naushad/android-sdks/tools

and then update your android if it is not updated to latest version :)
hope this will help some one.

Sunday, May 3, 2015

Android Interview Questions 2015

what is object serialisation.
Object serilzation is  a process of converting the  object into stream of bites.
what is implicit and explicit intent?

what is the difference between relative layout and linear layout.

how different application communicate with other application.

States of activity.
An activity has essentially four states:
  • If an activity in the foreground of the screen (at the top of the stack), it is active or running.
  • If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.
  • If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
  • If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.
The following diagram shows the important state paths of an Activity. The square rectangles represent callback methods you can implement to perform operations when the Activity moves between states. The colored ovals are major states the Activity can be in.
State diagram for an Android Activity Lifecycle.

http rest api description.

instgram clone how is your approach?

whatsapp clone whats your approach?

Difference between array and array list?
  
 * Array have fixed size where array list not.
 * You cannot use generics in array where in array list you can
 *You cannot store primitive values in array list only object can be stored in arrayl ist where array can    contain both primitive and objects.

How notification works in android.

Have you work on any github api

what is gradle?


what is test driven programming ?

Thursday, April 30, 2015

Using GIT with Android Studio on windows with terminal or toolbar

Today We are going to learn how we can create a git repository using android studio.
Android Studio Makes it very simple just follow the below steps and your project is on git :
First we setup our PC ::

Download git from :http://git-scm.com/download/win

install it.

for git repository online I am using Bitbucket  , bitbucket allow us to host private repository free you can also use github but your project should be public if you want to use it free.

Here I am going to use bitbucket:
Create repository
After creating repository  you will see screen like this


Now open AndroidStudio Create new project.
after creating the project clcik on VCS on menu strip  and enable git as shown below

Now your project git enabled ;
You can see terminal in andoid studio we can use it for git commands.
Now check terminal and write git status if it  give you below message :
'git' is not recognized as an internal or external command, operable program or batch file.
then you have to follow below steps (from Stackoverflow):

  • right-click "My Computer",
  • select "Properties",
  • open "Advanced",
  • click "Environment Variables",
  • highlight the "Path" variable,
  • click "Edit",
  • add your specific path to front of "Variable value" field, separated by a semicolon from the existing entry. Do not add a space between ; and last entry
Now your terminal should work with git command.

You have to put you remote address of your project   :

got to bitbucket page and get the link 






now you can use command or commit button in android studio to commit your project
 Now you can push your  changes to server. by git push -u origin master

you can refresh your bitbucket page and see your commits are there :)
Happy coding :)