2017-08-21 40 views
1

我歌林更新版本1.1.4-2然後我開始運行我的實際設備項目,但它顯示這個錯誤 - >錯誤字節碼轉換到DEX在真實設備whilte運行

Error message

模塊:應用程序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" 
    } 
} 

請告訴我如何解決這個問題。

回答

1

錯誤清楚地告訴您在庫的子模塊中將targetsource兼容性更改爲1.7。爲什麼不能改變這一點?

我認爲它可能要求您更改 此:

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

這樣:

compileKotlin { 
kotlinOptions { 
    jvmTarget = "1.7" 
} 
} 
compileTestKotlin { 
kotlinOptions { 
    jvmTarget = "1.7" 
} 
} 
相關問題