CommonsWare CommonsWare - 5 months ago 133
Android Question

What Is the Proper Project Configuration for the N Developer Preview?

The docs claim a

build.gradle
like this works:

android {
compileSdkVersion 'android-N'
buildToolsVersion 24.0.0
...

defaultConfig {
minSdkVersion 'N'
targetSdkVersion 'N'
...
}
...
}


That gives me
failed to find Build Tools revision 24.0.0
, when using
'com.android.tools.build:gradle:1.5.0'
for the Android Plugin for Gradle and Gradle 2.5.

If I look in
build-tools/
in my Android SDK installation, I see
24.0.0-preview
, not
24.0.0
. However, if I switch my
build.gradle
to use
buildToolsVersion "24.0.0-preview"
, I get
Invalid revision: 24.0.0-preview
.

So, what combination of
build.gradle
values works to build a project to compile against the N Developer Preview SDK?

Answer

Based on one of the sample apps, I am now using:

  • Gradle 2.10
  • 'com.android.tools.build:gradle:2.1.0-alpha1' for the Android Plugin for Gradle (goes in your top-level build.gradle file)
  • buildToolsVersion "24.0.0 rc1"

This seems to be holding up, including with Android Studio 1.5.1.

UPDATE: Now that N Developer Preview 4 has been released, we can start using 24 in place of "N" and "android-N":

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 24
    }
}
Comments