-1

While using LocalDate from(import java.time.LocalDate) I got this error:

Usage of API documented as @since 1.8+ less... This inspection finds all usages of methods that have @since tag in their documentation. This may be useful when development is performed under newer SDK version as the target platform for production.

app Gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.sha.sampleproject"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.+'
    testCompile 'junit:junit:4.12'
}
Shareque
  • 361
  • 4
  • 23

1 Answers1

1

That message you are getting is because this class was added in added in API level 26. Have a look. https://developer.android.com/reference/java/time/LocalDate.html

Older devices do not support Java 8 classes

If your minSdkVersion is lower than 26 then replace your use of LocalDate entirely or only use it on devices running API Level 26 or higher.

  • I changed min and max SDK to 26 but error is still there – Shareque Sep 09 '17 at 10:09
  • To over come this you need to goto File -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources -> Language Level and change that to the level 1.8 or the Project Default language level – Unique Identifier Sep 09 '17 at 14:08