Reputation: 49
I updated kolin version 1.1.4-2 and then i start running my project in real device but it's showing this error ->
Module:app build.gradle file i add last time targetCompatibility in dependency but it's not work at all. whenever i run in my device it's showing above error->
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.company.projectname"
minSdkVersion 17
targetSdkVersion 26
versionCode 2
versionName "1.1"
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 "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Project build.gradle file ->
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'kotlin'
allprojects {
repositories {
jcenter()
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
please tell me how to solve it.
Upvotes: 1
Views: 46
Reputation: 1153
The error clearly tells you to change the target
and source
compatibilities to 1.7
in a library's sub-module. Why can't just change that?
I think it probably asks you to change this:
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
to this:
compileKotlin {
kotlinOptions {
jvmTarget = "1.7"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.7"
}
}
Upvotes: 1