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

Problem

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'.

 Solution

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

New Year with new technologies – mostly lighttpd

My old VPS was kinda meeting it’s limits so I’ve decided to order new one.  Actually I’ve ordered new VPS a few months ago at Digital Ocean for a project I am not able to complete and won’t be ready for a few months, so I decided to use this server for this blog and several more domains.

Digital Ocean offers really great deals (20GB SSD & 512MB RAM for $5, really easy scalable) and after few months of testing I have no other choice than recommend. About creating droplets (means VPS) and managing web server maybe some other time, it’s like two clicks of mouse.

My old VPS is running LAMP (Linux, Apache 2, MySQL & PHP) and I’ve ordered only 512MB of RAM, I’ve decided to try Lighttpd instead of Apache just to save some memory. And it looks amazing.

At this very moment I’ve got three websites (powered by PHP framework – Nette), one WordPress site (this blog) and  flyspray site (bugtracking) on the VPS and it’s using 190MB of RAM.

The only thing I had to really resolve was the mod rewrite for WordPress. As a matter of fact it was really easy, check how to run wordpress on lighttpd.

Few hours ago I’ve  changed MX records and the blog is now running on the Lighty provided by Digital Ocean. Hooray.

WordPress on Lighty (lighttpd) with cool uri

If you wants to run WordPress site on Lighty (lighttpd) instead of Apache, you will find out that there is one little problem. Ligthy does not support .htaccess for mod_rewrite, so you will have to configure rewriting some other way. And it’s really simple, the only thing you really have to do is add this lines to your config file (/etc/lighttpd/lighttpd.conf):

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )

And check if you have mod_rewrite enabled in the same config file:

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_fastcgi",
        ... ,
        "mod_rewrite",
)

The complete record for this blog in lighttpd.conf is:

# this is the settings for blog subdomain running wordpress
$HTTP["host"] =~ "(blog\.)vyvazil\.eu$" {
        # these three lines below should be pointing at real paths 
        server.document-root = "/home/domains/vyvazil.eu/web/subdomains/blog/" 
        server.errorlog = "/home/domains/vyvazil.eu/web/log/error.log"
        accesslog.filename = "/home/domains/vyvazil.eu/web/log/access.log"

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )
}

 Don’t forget to restart your web server after saving changes in configuration file.

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.

junction

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.

connection-error.fw

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.

-Djava.net.preferIPv4Stack=true

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

-Djava.net.preferIPv6Addresses=true

 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).

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.

Android development – IDE – Eclipse vs. IntelliJ IDEA

Are you an Android developer? Or thinking about becoming one? There’s a lot of tutorials how to setup the basic environment (IDE, SDK, ADT plugin, …) and mostly it’s all about Eclipse. The main reason is that Google created ADT (Android Development Tools) plugin for Eclipse only (this plugin should help you develop your apps easier, we’ll get on this later).

I will tell you the truth: I really hate Eclipse! I’ve always hated Eclipse and it’s not getting any better. It might be a powerfull IDE but – call me superficial, I don’t care –  it’s ugly and slow. And not ugly in the way “just change font and background… wow, that’s not so ugly IDE now” (that’s what you get if you are trying to google that). It’s probably one of the worst apps I’ve ever seen. There’s a lot of really bad looking padding (that’s because you don’t have to see all the important stuff, so why not to use the space for paddings?), borders with radius as ugly as Samsung S3 and of course shadows and shitty icons.

I really don’t get why they don’t use Comics Sans by default. It would complete it.

What they didn’t tell you about Eclipse?

A few reasons why I am unable to use this software for android development. Some of them might be caused by ADT.

  • It’s slow. Really slow.
  • I’ve mentioned it’s ugly, right?
  • Sometimes you have to “Clean project” because suddenly some linked library is missing.
  • Sometimes you have to restart Eclipse because “Clean project” doesn’t work.
  • You are debugging your app so you want to show LogCat. But you really want to see your code too. Ok, you will drag tab with LogCat and move it to another monitor. Sweet, it’s working. But not the proper way. If your Eclipse window has focus, the window with LogCat will be shown too. That means you have to close and open LogCat everytime you need it, it’s not possible to have it running at background and just use ctrl + tab to switch.
  • And most annoying – you open for example manifest.xml, there’s an UI for android XML files, so you just fill in form and you don’t need to write XML by scratch. So you click in the correct input and trying to type, but nothings happens… Ok, click again, type again. Nothing. After 5 minutes of trying you find out, that you are typing the text in the different file. Why? I don’t know.

What’s the alternative?

You can use Netbeans (there’s a plugin for android development), but I haven’t tried that. For PHP development I use PHPStorm and I am really satisfied, So I’ve decided to give a try to another Jetbrains Tool – IntelliJ IDEA. There’s a community free version for Android development. And it works really good. Not frustrated anymore (OK, a little bit, I still have to use android emulator).

How to generate certificate for Windows Azure

Do you have Windows and Visual Studio installed? And if you are missing makecert in your system, try to install Windows Azure SDK. Allright, that’s all you need. Firstly look up for Visual Studio Command Prompt.

01

In the Command Prompt type:

makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss "<CertificateName>.cer"

certificate-windows-azure-01

Ok, you’ve got certificate, now we are going to export it. Run the certmgr. Open command prompt (cmd) – I usually start command prompt by pressing button with windows logo on it (on keyboard) a then just write cmd and press enter.

In command prompt type certmgr and hit enter. You should see window like this:

certificate-windows-azure-02Navigate to your certificate and choose All tasks -> Export.

certificate-windows-azure-03
In the next step choose: No, do not export the private key
certificate-windows-azure-06

certificate-windows-azure-07

And just browse for location where you want to save your certificate.

certificate-windows-azure-08

certificate-windows-azure-09

And it’s done. You’ve got your certificate prepared for uploading to Windows Azure.