将字节码转换为dex在实际设备中运行时出错

我更新了kolin版本1.1.4-2,然后我开始在真实的设备上运行我的项目,但它显示这个错误 – >

错误信息

模块:应用程序build.gradle文件我添加了上次的依赖目标兼容性,但它根本不工作。 每当我在我的设备运行它显示上面的错误 – >

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' } 

项目build.gradle文件 – >

 // 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" } } 

请告诉我如何解决它。

    这个错误清楚地告诉你在库的子模块中将targetsource兼容性改为1.7 。 为什么不能改变呢?

    我想这可能会让你改变这个:

     compileKotlin { kotlinOptions { jvmTarget = "1.8" } } compileTestKotlin { kotlinOptions { jvmTarget = "1.8" } } 

    对此:

     compileKotlin { kotlinOptions { jvmTarget = "1.7" } } compileTestKotlin { kotlinOptions { jvmTarget = "1.7" } }