android 错误找不到 class JobSchedular

android error cannot find class JobSchedular

我正在使用 android studio 3.1。这是我的构建文件

compileSdkVersion 26
defaultConfig {
    applicationId "com.example.appcomponentexample"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

我收到错误:

cannot find symbol class JobSchedular

当我使用 JobSchedular 尝试构建时 class。不知道怎么回事。

cannot find symbol class JobSchedular

当您没有正确导入 JobSchedular 时发生。将导入语句添加到您的 class:

import android.app.job.JobScheduler;

由于从 5.0 开始支持 JobScheduler,因此请记住对向后可比性的考虑。有关更多详细信息,请参阅此