サードパーティのjarエラーが表示されますをインポートするにはAndroidのメーカー

輸入netty.jar時の1が表示されます:

エラー:エラーDEXにバイトコードを変換:
原因:デックスできない解析バージョン52バイトコード。
これは、Java 8以上を使用してコンパイルされたライブラリの依存関係によって引き起こされます。
あなたは、ライブラリサブモジュールでのJava "のGradleプラグインを使用している場合は追加
=「1.7」targetCompatibilityを
sourceCompatibility =「1.7」
そのサブモジュールのbuild.gradleファイルに。


2.具体的な解決策は以下のとおりです。

app.gradleに参加しています:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.zhouyong0701.nettytest"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}


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:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile files('libs/netty-all-4.1.15.Final.jar')
}


jackOptions {
            enabled true
}
compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}


上記の修正に追加することで問題を解決することができます。



公開された35元の記事 ウォンの賞賛9 ビュー30000 +

おすすめ

転載: blog.csdn.net/ZHOUYONGXYZ/article/details/77869220