ButterKnife inject views in Fragment

I’ve lost a lot of time to figure it out. I had in onCreateView() in my Fragment:

 ButterKnife.inject(this, rootView);

and it wasn’t working (nullpointerexception), so I was testing what’s wrong and could not fixed it, because it looked allright. And the solution is simple as always. This is the solution for Android Studio (for Eclipse check this)

Open File -> Settings (ctrl + alt + s). Navigate to Compiler -> Annotation Processors and at the top of the window check the Enable annotation processing. That’s it.


Android Studio – Could not create plugin of type ‘AppPlugin’


I’ve updated Android Studio & SDK, then updated build.gradle to be using latest build tools and gradle plugin. And because IDE showed me some errors about using auto import for gradle, I’ve decided to install latest gradle and use it locally. But when I tried build my project I got this error.

A problem occurred evaluating project ':Project'.
> Could not create plugin of type 'AppPlugin'.


Don’t use latest Gradle (version 1.10), downgrade to 1.9.

Android Studio not using built in SDK

If you download Android Studio you’re probably ready to develop the apps instantly, because there is built in SDK (android) in the software. That’s sweet for new developers, not for me, because I have used Eclipse and sometimes I run this IDE too. And that means I already downloaded SDK, unzipped it in different path, download all important images and set up all virtual devices.

And there’s a problem. Even if I set up Android studio to use my SDK path, it sometimes doesn’t work and it uses Android Studio path (../android_studio/sdk/). That means I have to create demanded virtual device (and sometimes download correct API version images). And because Android Studio is EAP, the settings might not work and sometimes I’m not able to change the path.

Here’s the quick fix. Delete the SDK folder from Android Studio folder and create junction (in Windows). That means run command prompt (press button with windows logo at keyboard, type cmd, press enter) and type in this command:

MKLINK /J [destination path] [sdk path]

In my case it was:

MKLINK /J C:\Java\android_studio\sdk C:\Java\sdk

Here we are, problem succesfully solved.


Android Studio – connection error

If you are experiencing a connection error trying to update Android Studio ( – Connection error. Please check your network connection and try again), you probably googled that’s an error in Android Studio.


Quick fix

Just add the following line to .vmoption file. It is located in your installation path (aka C:\Program Files (x86)\Android\android-studio\bin). There are two files you should check: studio.exe.vmoptions and studio64.exe.vmoptions.  Change the one you are using or both just to be sure.


or you prefer IPv6 (if you don’t know what IPv6 is, just use the first line)


 Still not working?

Try to run your Android Studio directly from installation path (C:\Program Files (x86)\Android\android-studio\bin) by clicking studio.exe or studio64.exe and update the Android Studio then. After update you are able to run Android Studio the usual way.

Android studio – Project Wizzard

I’ve prepared some screenshots from Android studio’s project wizzard, as you can see, the functionality is the same like in Eclipse.

Android studio is better than Eclipse, you should try it. It’s faster, smoother, not ugly and have nice dark theme (darcula).

How to fix Android Studio which doesn’t start

Have you installed Android Studio and it doesn’t start after clicking the program icon? The fix is simple. Firstly, you should download (update to) the latest Java Development Kit (current version is 7u21).

One of my Java friends told me not to install Java (and anything Java related) to the default installation path because of spaces in the path (there’s a space in the Program Files) and have a special directory for Java like C:/Java/… Spaces in the path might cause errors.

I am punk so I am using the default paths anyway

Setting system variable – PATH

Notice: I will be working with Java path C:\Program Files\Java\jdk1.7.0_21\, it could be something else in your case, just check the path and if you have installed Java somewhere else, change it to desired destination.


Type SET PATH in commnad prompt, you should have something like C:\Program Files\Java\jdk1.7.0_21\bin in there. If not, open Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables and in System variables modify the PATH variable. Add C:\Program Files\Java\jdk1.7.0_21\bin to the end. Be sure there’s no space at the end of the line. See screenshots below.

Save the changes, you don’t need to restart computer, but you have to reload command prompt.

There might be a problem, check if you don’t have java.exe in the C:/Windows/System32/. If the file is in this location, you should rename (or delete if you are brave) it. Reload command prompt ant type java -version to check if everything is allright.

Set JAVA_HOME and JDK_HOME variables

JDK_HOME should be enough but someone experienced a problem without JAVA_HOME, so set them both for sure.

We are going to continue. Type SET JAVA and SET JDK to command prompt to check if the variables are set up. Are they not? Ok, you should add them to the system variables. Once again – Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables.

Add JDK_HOME and JAVA_HOME with value C:\Program Files\Java\jdk1.7.0_21\. Do you see the screenshot below? It won’t work because there’s a space left at the end of value line! Check it and save it.android-studio-fix-05

And that’s it, you are ready to go, everything should be set up and Android Studio should start right after you click the icon.



Hooray! Android studio is alive.

Recently I published an article about my frustration of using Eclipse for android development and switching to IntelliJ IDEA. And what a great news! Google announced Android Studio.

Basically it’s customized IntelliJ IDEA (v13, at this moment EAP). At this moment, IntelliJ IDEA 13 doesn’t have customized project creation (wizzard) and App Engine cloud endpoints integration, but it will be available in few weeks. So it doesn’t matter if you are using IntelliJ or Android studio, it should be the same in the future. More information on this topic you should find at FAQ Jetbrains page.

Play console was improved too – beta releases and staged rollout was added.

If you are experiencing a problem running Android Studio, check out this page, it might help you.