Saturday, February 25, 2017

Best Foods and Strategies for Eating at Your Computer

This is again bit different blog from my side. Till now I have been writing blogs on coding issues and updates and technologies etc but now I have decided to focus on some other areas like tech humor and other things related to computers and programmers. This blog is about foods you can east near your computers and how to have them so that it does not harm your computer. I am sure you don't want to ruin your computer because of some accident while eating near your computer, as shown in the image below.



This type of accident can ruin your computer and data inside it and in turn it can ruin your work. So better to take care about it. I have been working as a software engineer since last 9 years so sometime I don't get enough time to eat so sometimes I eat while I am working near the computer so some of the tips mentioned here are from my own experiences. By the way I never ever had an accident while eating near the computer and ruined my computer.

Tip 1 : Avoid cold drinks if possible or else be careful


As we all know a cup of coffee is must for the programmers and specifically for those who are working late nights. There are even jokes about coffee and programmers like.


Programmer - An organism that converts caffeine into code

So a coffee is must for the programmer but this is the drink that ruins your computer most of the time. Here are some situations

  • You are looking at your code and are so stressed that you don't even know that a drink is spilled on your keyboard. 
  • Sometimes after having a sip when you are putting it back, but you are still looking at your screen an boom, accident can happen. 
  • Sometimes if drink is cold or you just took it out of the fridge, there is a water at outer layer of container and its dropping when you are holding in your hand



So there are many ways a drink can ruin your computer so be careful while using it. As mentioned earlier

  • Look at when you are taking it for a sip and putting it back.
  • Avoid cold drinks and if you are having it make sure you sip it from distance.
  • Keep the cold drinks away from your computer.

Tip 2 : Avoid food with sprinkles or garnishing and sauces




There are foods like potato chips or pea nuts or say cashews which has sprinkles of spices on top of it. When you eat it with your hand, some of the sprinkles will remain in your finger tips and when you touch key board with it, will make your keyboard dirty. Either you have to wipe out the keyboard or wipe out your hand every time and that will not just delay your work but it will also break your concentration so better to avoid this types of food. You can have plain food without any sprinkles on top of it. Also you can avoid foods with sauces as there is possibilities of dropping sauces on keyboard while you are eating it so better to avoid it. Avoid the foods that creates mess around your computer.


Tip 3: If you are having fruits, avoid juicer fruits and cold fruits




Fruits are the best things to eat near the computer because most of the fruits like grapes and bananas you can eat with your hands and there is no possibilities of spilling. However some juicer fruits should be avoided as there may be possibility of spilling of juice on keyboard. At the same time avoid fruits that just came out of refrigerator as that has water coating on surface and it will make your finger tips dirty and eventually will make your keyboard dirty. Do not eat fruits juiciest fruits like water melons, Oranges etc. 

Hope this tips helps you and save your computer.

Laravel: Failed to connect to 192.241.224.13 port 80 on OSX

Recently I was trying to create new Laravel application with Laravel installer, it was not working and it was throwing following error.

Failed to connect to 192.241.224.13 port 80: Operation timed out [url] http://192.241.224.13/laravel-craft.zip

I was not sure about error so I tried few things like updating composer and updating laravel installer but still it was not working but finally I was able to solve problem so in this blog I am going to explain how to solve this issue.

This issue is because even after updating laravel installer version with composer it's still using old version of composer which was installed in /usr/local/bin library. To find out this type following command in terminal.

laravel --version

If it shows following output that means you are still using old version of laravel installer.

Laravel Craft version 1.0.0


So to remove this version first of all remove old version. Go to terminal and type following command.

rm /usr/local/bin/laravel

Now will again install laravel with following command.

composer global require "laravel/installer"

It will install laravel in your users home directory, so you have to add path to it in your bash_profile file. Open the bash_profile file for editing.

sudo nano ~/.bash_profile

And copy following line in it.

export PATH=/Users/USERNAME/.composer/vendor/bin:$PATH

In above line replace USERNAME with your OSX username. Save the file and reopen the terminal. Now again type following command.

laravel --version

And it will show following output.

Laravel Installer version 1.3.1

So now you have the latest version of laravel installer, create new laravel application with following command

laravel new app-name

Hope this helps you.




Monday, February 20, 2017

Stop User From Uninstalling Your Mobile App

I have been developing mobile applications since last 5 years and over this period of time I have developed many applications for Android and iOS. These applications includes both native and hybrid applications. In this blog I am going to explain certain important things you should consider while developing mobile app so users won't uninstall after using it. These is based on my own experience of developing mobile applications. You may have other views on this. Let me know your views in comments.

Do not increase size of your mobile application


This is first and foremost factor you have to consider while developing mobile application. Now a days storage is biggest concern in smart phones. You have so much other data like photos, videos, musics etc. So at most of the time you get waring of "Storage space running low" at this time users will uninstall mobiles apps which is taking too much space. So if your mobile application is heavy in size and consume lots of spaces on your mobile phone at one point of time, users will going to uninstall your application so make sure you keep size of your application to some limits. Make sure you store data in SD cards so that your application does not consume much size. Try to clean up storage space from the app so that you do not have unnecessary data.

Real Life Story : Let me give you an example on how we reduced size of mobile app. In one of the app we need to have text to speech function. There is a lesson and user can play audio of that lesson and can hear it. So we decided to use in built text to speech function of android so we don't have to include MP4 files of audios.

Make it efficient to consume less data and battery


People now a days are very conscious about their phones, they can not live without it so they make sure that there is always active data connection and mobile battery is always charged. In this case if your application is consuming too much data and battery and your user has to charge it very often then there is high chance that they will uninstall your application. So make sure if you have functions like background services, GPS , location tracking, you also have strategy to save battery power. Always use power saving strategy. At the same time make sure your application is not using too much network data.

Real life story : We created mobile app to background location tracking. First we were tracking user location each 10 seconds for very accurate tracking but battery of mobile phone was always drained so later we changed location strategy and tracked user location based on considerable movements and at regular time interval of 5 minutes and used network locations as well.


Make sure they understand application


This problem is particularly with business applications where users of mobile app have difficulties in understanding functions of the app. They do not understand the flow and screens of the app and hence they get confused and stop using application. This rate is very high in business app and business app comes with strict requirements and flow as per each business and users have to understand it. To solve this problem you can include tutorials in your mobile application. You can use overlay tutorials on your mobile application screens to point out functions of each buttons and screens so user will know where to tap and what's the flow of the app.


Make sure application is bug free and do not crash often


If your application crashes often and have bugs your user is going to be annoyed with your app and will uninstall your application so make sure your application is bug free and do not crash. Although most of the developers will make their application bug free but still sometimes it happens that your mobile app crashes due to some reasons and no user will like it. So make sure you handle all the errors and exception properly.


Allow user to remove Ads


Well, the ultimate aim of the mobile application is to generate revenue from it and for that most of the users will put ads in the mobile app but sometimes these ads are annoying for end users. Specifically the ads which pop ups suddenly and stops users from doing work with app. Specifically for the games user will not like ads if it is not letting them play games properly so user will uninstall mobile app if you not allow them to remove ads. So yes you can add the ads in mobile app but let user remove it for the session while they are using the application. So they can hide it temporarily and use your app. 

Along with these there are some small tips you can also consider. 

  • Do not annoy user with too much notifications
  • Make UI very fast and responsive
  • Choose color scheme properly
  • Make it responsive to fit in all the screens
  • Do not use big images


If you consider these factors while developing your app user will not uninstall your app. 

Saturday, February 18, 2017

Tech Humor - A Programmer's Revenge, Deal With Frustration At Work

Hello, this is bit different blog post. Usually I write blogs on very serious stuff like solving coding issues and about technologies and careers and about latest trends on IT industries etc. Now I feel that my blog is becoming very serious so I decided to write some blogs on lighter notes. Now you will read about funny things happened while working on projects some practical jokes on programming and all. I short I am going to add bit humor on my blog. In this first post I am going explain how I took revenge on end users of my projects.



A Programmer's Revenge


A programmer is a person who is working all days long in front of computers. He has to deal with all kind of annoying stuff like funny and impractical demands of customers, anger of his boss, anger of tester, humiliation from boss and team leaders or may be from co workers. A programmer deals everyday with these and more of the other things like.

  • Sudden change in requirements
  • Rewrite entire code again
  • Work rejected by client or team leaders
  • Do extra work without any rewards
  • No credit on successful completion
  • Tight deadlines or change in deadlines
  • No help from co workers of leaders
  • No motivation from boss and team leads
So in short a programmer is always in frustration most of the times and eager to take revenge but can't do that as he is afraid of loosing job or cut pay  etc. So here are some funny ways you can take out your frustration and nobody will notice it and still you will have some kind of satisfaction that you took revenge of all the humiliations, frustrations, disappointments etc.


Add Some Funny Comments and Lines in Code


This is the most hidden way to take out your frustration as no one els is going to look at source code except you and your team. Most of the time client is not going to see the source code so they will not read comments. Here are some example of comments I have used while I was working on projects to take out my frustration.

//Function : Name of Function
//Author : Hiren Dave
//Description : Use it at your own risk. Do not come to me crying if it crashes

Exception exp = new Exception("Some idiot entered wrong data");
throw exp;

if(!isNan(maxSalary)){
      //God has given brain to all human but some idiots still enter wrong data so we have to check.
       alert('Invalid Salary.');
       return;
}

//What's in the name? Yes everything is in name. It is necessary.

//I can't take it anymore I am exhausted, will fix it later.

//I just don't know why I am writing this code. It's unnecessary but it's part of my job so doing it.

So yes these are some comments I used over the time to take out my frustrations and took my revenge. You can also try this, it will surely help you to manage with your anger and frustration.

Play Shooting And Fighting Games


This is the other way I took out my frustration. Whenever I am frustrated and angry I play shooting and fighting games and squash the opponents in games to release anger and took my revenge virtually in games. Games really help in this matter as you are just hurting virtual characters in games. Here are some games I play for sometime to take out my frustration.

Whack Your Boss
Desert Rifle
Street Fights


These ways you can took your revenge and can deal with frustrations. Hope this helps you.

Friday, February 17, 2017

Top 3 Tips of Effective Google Search For Developers

This blog post is for the developers who are stuck in some errors and not able to solve it and looking for solutions on Google but not able to find it because they are not searching it properly. So here in this blog I am going to explain some tips which I have been using over the period of time and most of the time I am able to get solution through Google and solve my problem.



Tip 1 : Use Error Codes to Search


Most of the time whenever there is exception or errors, there is an error code displayed in the error stack trace. Use that error code to search on Google and use the ClassName or component name which is throwing this error with type of error. For example Android MediaRecorder. When you are using media recorder there are error codes attached with each action and each stage of MediaRecorder. For example

Android MediaRecorder start failed - 38
Android MediaRecorder start failed - 19

When you search in Google with the error.  Android MediaRecorder start failed - 38, you will get following links.


As you can see in above screenshot there is top links of popular website StackOverFlow where others have posted this question and there will be solution here so your problem is solved.

Another example in windows whenever there is problem with drivers of any hardware it gives code 28 errors. So to search in Google use following

Windows error code 28

And you will get number of blog post to solve this error.

Tip 2 : Use Name of Exception To Search, Do not Copy paste whole stack trace


Whenever there is an exception in program, you will get stack trace where it shows all the classes and files and number of line from where exception is thrown. Do not copy paste that stack track in Google Search. Use first line of Stack trace, which is normally type of exception. For example, in android app is some class is not found at runtime it throws ClassNotFound exception. So to solve that error, search in Google 

Android ClassNotFound "ClassName"

And it will give you relevant links where there will be solution for this. So your error can be solved easily.

Tip 3 : Be Specific for What you Want to Search and Use Keywords


Be as specific as possible in your search query so Google can search relevant links for you. For example, if you want to hide element with JavaScript. If you give search

Hide element

It will give you links with hiding element using CSS and JavaScript and jQuery and Angular and all. But if you want specific result with say jQuery or JavaScript, use that key word in your search result.

Hide element jQuery
Hide element JavaScript

Then it will give you relevant links with exactly what you are looking for. Same way for anything else use key words. For example if you are looking for tutorials to start with. Use search like

Laravel Getting Started
Android quick start
Angular quick start etc. Because most of the bloggers who write blogs on Getting started, they use titles like Getting started, quick start etc. You will get what you want on the first page of Google.

Hope this helps you.

Wednesday, February 15, 2017

Copy Paste - Blessing or Curse for Developers

Let's start this blog by asking a simple question to yourself.


Are you a Copy Paste Developer?


Most of the readers who are reading this post, will answer Yes for this question. We all are copy paste developer at one time. I am also a copy paste developer. I usually copy paste some lines of code from my old projects or from some blog post or from the StackOverFlow. All the developers to that at one point of the time. We do this to save our time and efforts. 

So now the questions are Does copy paste always works? Does it make your code better or worst? So in short it is blessing or curse for developers. 

Well, I would say that if you copy paste and do it wisely and with proper understanding then it's really a blessing for you but if you do it blindly you could end up in disaster. It will introduce so many other bugs in your code and eventually you have to start from scratch. 

What are the Good Things about Copy Paste?



Being a copy paster programmer at some time I would say in most of the cases copy paste is good for the developers. You don't have to rewrite entire code once again. With copy paste and little changes you can solve your problem easily. It saves your time and efforts and can solve your problems easily. 

I would like to share my experience here. When I started working on creating iOS app, I was not having enough knowledge of Objective C and all and still I created a full fledge iOS application with Copy Paste. I was working on application for motivational speaker. The requirement was to create app to list lessons of speaker and when user tap on lessons show details of lesson with videos and picture gallery. So what I did is I found open source application for food recipes. Application was very similar to what I was looking for. First of all list of recipes and then details of recipe. So I copy paste the code with views and controllers and all and instead of recipes, put motivational lessons and bingo the app is created. So here copy paste was blessing for me. I created entire IOS application in a week and with much less efforts.

So copy paste is always blessing for developers but you have to make sure certain things while doing copy paste. 

  • Understand the code which you are copy pasting
  • Modify it as per your coding standards and as per your code logic
  • Check for errors in the code before copy paste
  • Do testing after copy paste
  • Write comments in your code after copy paste

What are the Bad Things about Copy Paste?


Copy Paste could be disaster for your if you just do it blindly and you do not try to understand what you are copy pasting. Everyone copies code from StackOverflow or other forums from time to time. Hopefully, you do it sensibly, using it as a starting point for your own production code — working through what you’ve just pasted in to understand it, experimenting with it, modifying it, making it fit for your purpose rather than just blindly copy-and-pasting random code from the internet. It's possible that code which you are copy pasting may have errors or may have entirely different purpose than yours. So it can cause issues in your code and can break your code. 

So I would say only one thing, understand the code which you are planning to copy paste and then copy paste it. 

So it's up to you to turn copy paste into blessing or curse. If you do it wisely, it will always be blessing and there are very rare chance that it may turn into curse for you.

Sunday, February 12, 2017

Why Artificial Intelligence Is Must In Business Application

In this blog I am going to explain why Artificial Intelligence should be added in Business Applications. These are my own point of views which I felt after working on many business applications for more than 7 years. You may have different point of views or you may want to add more to this list. Feel free to add comments in case if you want to share more on it.



What is Artificial Intelligence?


The theory and development of computer systems able to perform tasks which normally requiring human intelligence, such as visual perception, speech recognition, decision-making, and translation between languages. So by adding Artificial Intelligence you let computer system to take decisions on behalf of you. 

In this blog I am going talk particularly about decision making by AI in your system and why it's required. So lets understand what is decision making in business applications?


Each business application have it's own set of rules for decision making but decision masking simply refers to take decision in systems like 

Shall allow user to do task or not?
If not then who else will do it?
If the input is correctly processed or not? etc. Like I said it depends on business to business. Lets see couple of example of real businesses to get more clarity on it.

1) Lead Management

From your sales department, there are lots of leads coming per day. Decision on whom to assign lead is taken my managers on considering so many factors.

  • A person have worked on similar type of lead in past
  • A person can handle business volume mentioned in lead
  • A lead is in area which covered by a person.
  • A person is free to take a lead etc..
These are the factors considered by manager to assign lead to particular person. So this is what is decision making.

2)  Online Shopping

If you have shopped online in past you may have realized that when you go to same eCommerce site again it will show you similar products which you have bought and will prompt you to buy it. There are many factors considered here.

  • What types if products generally you buy?
  • How many times you buy?
  • In what amount you buy? etc.
So based on above factors, it will recommend you products and you may buy it.

So this is what is decision making normally in business applications there is logic for this type of decision making. They let system users to take decision and this is good but sometimes it creates issues. Following are some factors due to which you must add AI for decision making in your business application. 

1) People are lazy in taking decisions

This is first affecting factor of decision making. People who are using system are sometimes very lazy in taking decision. They don't care about time. The data is on their dashboard but they don't even look at it and this hurts overall productivity of the system so it will be better to have AI to take decisions. We can write code to enforce all the business rules for taking decision and let the system take decision about it. This will be very quick and easy process as the automated system will take decision as soon as there is data. 

2) People want to break the rules in the system.

This is my other observation. People always want to break rules in system some times intentionally or some time un intentionally. They don't care about correctness of data. They completely ignore it sometimes and that's why overall system breaks down so it will be better to AI to auto correct human mistakes. We can enforce law in code so the system can auto correct data. So even people want to break the rules they can not. System will prevent them and thus overall system is saved.

So it's always better to have AI added in business application for decision making so that no one can break your system and overall productivity of system is increased.

How To Fix Code 28 Errors in Windows

Today I was called to fix windows again. There was a problem in connecting to internet in windows PC as drivers were not installed for ethernet controller. So I fixed it. I never liked fixing windows, no programmers likes it. I published blog about this few days back. You can read it from following link.

5 Things Programmers Don't Do or Hate to Do

But anyways, I was called to fix it so I fixed it. In this blog I am going to explain how to solve Code 28 error

The drivers for this device are not installed. (Code 28)

When I checked ethernet device, it was showing above error. So first I tired to update driver by let windows automatically search for it but it did not give any result. Tried updating windows also but it didn't work. So finally I had to do all the process manually. First of all to identify which driver you will need download and install following software.

Driver Easy

This software has vast database of drivers so it can find required driver for you very easily. Install the software and scan your computer with it. It will show you device driver software for it and will download it. If you are luck this software will automatically install it but I was not lucky. I am never lucky when I have to fix the things. So again I have to do manual process. Here are steps. This software will show you folder where it has downloaded device driver so keep that folder open, we will need it in later step.

1) Go to Device Manager from Control Panel and click on Ethernet controller.

2) Click on Update Driver, it will show you following screen


3) Select the second option "Browse my computer for driver software". Once you click on second option, it will show you following screen.


4) Click on Have Disk in above screen and it will show you following screen.


5) Click on Browse and go to folder where Driver Easy has downloaded your device driver. From that folder select .inf file and it will start driver installation.

Once the driver is installed it will show you success message. After that just restart your PC to make sure device driver installed successfully. In my case issue was solved after restart and internet connection was working. Hopefully it will solve your problem as well.

Saturday, February 11, 2017

Effective Way to Create and Save File In Android Application

Hello, in this blog post I am going to explain effective way of creating and saving file in android application. Also will explain what are the general mistakes developer make in creating and saving file and how to prevent it.

Why it is important to have strategy for File create and Save in Android?



Because android file system is very similar to disk based file system and when there is a problem in creating or saving file it throws IOException so your application may crash while it's running and it's not good for professional or business application. So you need a proper strategy to create and save file and you have to add all kind of checks and exception handling for this.


Common mistake by developers on Creating and Save file in Android


Any new developer who is working first time on the file make this mistake. They don't know how to create a file and they do not refer to android developer site and android SDK document. They just search on web and find answers on site like StackOverFlow and copy paste the code. But sometime what happens is the code which they have used was about saving file in SD card and it may be possible that some phones do not have SD card so when the application is running in these phones, it crashes.

Another mistake is, in the code they hard code the path of saving file. Each android version and phone has different way of handling SD card so if you hard code the path it may work in your phone but it does not work in other phone. So here you need some strategy for this and make sure that your code works in all scenarios.  Here are some common things you should consider while creating and saving file.


  1. Decide where you want to store file, in external storage or internal storage.
  2. If storing in internal storage make sure there is space available.
  3. If storing in external storage, first check if there is external storage is available and there is a space.
  4. Make sure you have permission to store files in external storage. 

If you have requirement that file created should only be accessed by your app, you should create it in internal storage in app directory or else you should create it in external storage. Here is the code I have used in one of my app to create file in external storage.

For this you should also have permission mentioned in your android manifest file.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />


public static final int MEDIA_TYPE_IMAGE = 1;
public static final int MEDIA_TYPE_VIDEO = 2;

private static File getOutputMediaFile(int type){
// To be safe, you should check that the SDCard is mounted
// using Environment.getExternalStorageState() before doing this.

File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
 Environment.DIRECTORY_PICTURES), "YOURAPP");

// Create the storage directory if it does not exist
if (! mediaStorageDir.exists()){
if (! mediaStorageDir.mkdirs()){
Log.d("YOURAPP", "failed to create directory");
return null;
}
}

// Create a media file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File mediaFile;
if (type == MEDIA_TYPE_IMAGE){
mediaFile = new File(mediaStorageDir.getPath() + File.separator +
"IMG_"+ timeStamp + ".jpg");
} else if(type == MEDIA_TYPE_VIDEO) {
mediaFile = new File(mediaStorageDir.getPath() + File.separator +
"VID_"+ timeStamp + ".3gp");
} else {
return null;
}
return mediaFile;
}

As you see in above code, we are first checking if external storage is available or not. If it's not available, you just return null and if it's available, depending on file you want to create, create unique file name with current time stamp. Do not use hard coded file name like myVideo.3gp and it will always overwrite the previously created file.

Now we will use above function to check if we have file created or not in external storage and if not created we will create it in internal storage.

try{
File outputFile = getOutputMediaFile(MEDIA_TYPE_VIDEO);

if(outputFile == null){
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
outputFile = new File(getFilesDir() + "/"  + File.separator +
"VID_"+ timeStamp + ".3gp");
}
} catch (IOException e) {
Log.d(TAG, "IOException creating file : " + e.getMessage());
}

As you see in above code we are calling this function to create file of type video and check if it returns null. If it returns null then we are creating file in internal storage. Following line creates file in internal directory.

outputFile = new File(getFilesDir() + "/"  + File.separator +
"VID_"+ timeStamp + ".3gp");

And we have enclosed code try catch block to catch any possible IOException. In case of exception, you should properly display a message to user.

Sunday, February 5, 2017

Why I Rejected A Project Manager With 10 Years of Experience

Recently we were hiring a project manager for our company. We scheduled interviews for few candidates. There was one candidate having 10 years of experience in project management. His skills were good, he has good experience of handling mid to large projects and have worked with small to medium size team. Everything was good. I almost make up a mind to hire him but later he said something which screwed up all the things and that is.

I WILL NOT WRITE A SINGLE LINE OF CODE


That is something I feel that a manager should not do particularly when you are working with small or medium size team. I understand that a job of project manager is to manage team and setting up goals and lead the project from start to end. The main job of an engineering manager is to grow their team - by hiring good engineers and by helping each existing engineer on their team become a better engineer.

But what I feel is when you are working with small or medium size team, as a project manager sometime you may have to participate as programmer and help the team and team members. I have been working in IT industry since last 10 years and during that time I have evolved from being a developer to project manager but I still write codes while managing projects and you have to do it sometime. Particularly when you don't have efficient team members. For example once I faced this situation. There was project with tight deadline and my most experienced developers quit the job and I was not having any option to replace them immediately but the deadline is deadline, you have to deliver. You can not tell client that I don't have resources. So at this point a project manager has to act as programmer and finish the job. 

Also sometimes there is a situation due to security reasons, you are not allowed to expose source code to team members or you don't trust your team members so in in this case you have to write a code and make the necessary changes.

Also as a project manager, you have to review and correct code of your team members and this sometimes you have to do it. You can not always ask team members to correct it. Sometimes they don't understand verbal communication, you have to show them example by writing code and show them. 

Coding cannot be the primary activity of the development manager. However, development manager capable of coding influence team members much better than those with no coding skills. In smaller teams, manager should be able to review and correct the code. If required, manager should be able to write a small portion of the code.

So in my opinion, I would prefer to have project manager with coding skills and IT background and if required he shall be able to write codes and explain to team members. He should be able to manage project in difficult times like lack of resources and tight deadline. This is my opinion you may have other opinions about this. Do let me know if you have anything to add to this.

Friday, February 3, 2017

Android SDK Content Loader failing with NullPointerException

I have just recently started getting an error any time I interact with the Android SDK and AVD Manager in Eclipse. It does not load SDK manager and when I try to open AVD manager it says please set "Android SDK path in preference". This was strange error I started getting since I added few AVDs with Google API and when I check log of NullPointerException it was showing error in AVD Info class so I was sure that error is related to AVD. May be I misconfigured AVD while creating and now it's not allowing me to do any work in Eclipse.

So to solve this error you have to delete .android directory located in your user profile folder if you are using Windows and if you are using Mac, this will be hidden directory in your home directory.

So first of all make all the hidden directory visible. First of all open terminal and type following commands.

defaults write com.apple.Fider AppleShowallFiles YES

Now you have to kill all the finders and then go to home directory.

Killall Finder

Now when you go to home directory you will see .android directory which was hidden.


Delete that directory and even delete it from trash.

Now restart the Eclipse and try to load AVD manager and Android SDK manager and it should work fine.

NOTE : Please note if you delete .android directory, you will loose all the AVD you have created before and some of your preference of eclipse, so please use it carefully.