0

I'm developing an app for the Android L preview. I want to use some of the new API's but for some reason it seems like I'm missing them.

My build.gradle file looks like this: (and it works)

apply plugin: 'com.android.application'

android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'

defaultConfig {
    applicationId "com.my.app"
    minSdkVersion 'L'
    targetSdkVersion 'L'
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

// http://stackoverflow.com/questions/22851103/android-studio-gradle-error-multiple-dex-files-define
dexOptions {
    preDexLibraries = false
}
}

repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])


compile 'com.github.gabrielemariotti.recyclerview:recyclerview-animators:0.1.0-SNAPSHOT@aar'

compile 'com.squareup.picasso:picasso:2+'
compile 'com.google.apis:google-api-services-drive:+' exclude module: 'httpclient'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.http-client:google-http-client-gson:+'

compile 'com.android.support:support-v4:20.+' // compile 'com.android.support:support-v4:+'
compile "com.android.support:support-v13:20.+" // needed?

//compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:4.2.42'

compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
}

I also use many of the features from the support libraries like the RecyclerView.

However, if I try to access some of the new services, like the Job Scheduler i run into problems. Whenever I try to access Context.NEW_SERVICE (like Context.JOB_SCHEDULER_SERVICE) it doesn't find it. I looked into Context.class and JOB_SCHEDULER_SERVICE simply isn't there. However, it seems like I'm looking in the correct Context.class file because it's located inside the android-20.jar.

Any ideas why I can't access the JOB_SCHEDULER_SERVICE service?

Markus
  • 2,526
  • 4
  • 28
  • 35
  • maybe because it's a "preview" so it's simply not there on the Nexus5 or 7. – Budius Sep 11 '14 at 15:24
  • 1
    @Budius No, I am running the L preview on both of my developing Nexus devices. Also, it should work in the emulator, but it wont even compile. Also, the JobInfo class (and other classes) are not missing, only the Strings in Context.class – Markus Sep 11 '14 at 15:32

0 Answers0