2016-12-14 98 views
2

匕首2不能用java 8和傑克啓用。嘗試用不同版本的匕首2.x解決此問題沒有幫助。前工作正常,但是當我嘗試添加Java 8時發生此錯誤:匕首2與Java 8錯誤編譯

Error:Execution failed for task ':app:transformJackWithJackForDebug'. 
> com.android.jack.ir.JNodeInternalError: java.lang.Exception: java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.whitespace()Lcom/google/common/base/CharMatcher; 

應用gradle這個:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.0" 
    defaultConfig { 
     applicationId "com.test.my.project" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     jackOptions { 
      enabled true 

    } 
} 

buildTypes { 
    release { 
     minifyEnabled true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
    } 
} 
dependencies { 
    compile 'com.android.support:appcompat-v7:25.0.1' 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.google.dagger:dagger:2.5' 
    annotationProcessor "com.google.dagger:dagger-compiler:2.5" 
    compile 'com.google.android.gms:play-services-maps:10.0.1'  
} 

的gradle項目:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

回答

1

Charmatcher.whitespace()番石榴引入19外貌就像你有一些編譯對Guava 19的代碼一樣,但是最終的結果比類路徑上的更早。

+0

你能解釋一下嗎? –