Android, Java

Failed to find target android-18… D’oh!

One of the first problems I’ve found on my Android adventure is to configure the environment. Although there are lots of tutorials and IDEs to do it for me, I’ve decided to start building my “toys” with the newest building tool, Gradle (http://www.gradle.org).

The first impressions with gradle were good, however once I started to configure the project as Android application, a strange issue started to appear in my console, an error telling me that the compiler failed to find the target android:

My Computer:project-dir user$ gradle assemble

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':mobile-app:packageDebug'.
> failed to find target android-18

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.56 secs

This started to happen once I introduced the android plugin in the gradle config file:

apply plugin: 'android'

android {
compileSdkVersion 18
buildToolsVersion "18.0.0"
}

dependencies {...}

So, after googling a bit, I discovered that the problem was that I wasn’t pointing to the sdk version I had installed, so I opened /adt/sdk/tools/android:

android_sdk_manager

And, change the buildToolsVersion with the installed version:

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion "19.0.3”
}

dependencies {...}

Once I did this everything started to work fine. Easy, simple and… obvious, d’oh!

Advertisement
Standard

4 thoughts on “Failed to find target android-18… D’oh!

  1. Johna536 says:

    Hi there, just became aware of your blog through Google, and found that it’s truly informative. Im gonna watch out for brussels. I will appreciate if you continue this in future. Many people will be benefited from your writing. Cheers! eecbckbdabka

  2. This article is very informative but it took me a long time to find it in google.

    I found it on 13 spot, you should focus on quality backlinks building,
    it will help you to rank to google top 10. And i know how to
    help you, just search in google – k2 seo
    tips and tricks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s