2017-03-06 112 views
4

我的錯誤是: 錯誤:執行任務':app:compileDebugJavaWithJavac'失敗。無法創建MD5哈希文件?

Failed to create MD5 hash for file 'D:\Android\AsianNEws\PNRstatus\app\libs\httpclient-4.3.6.jar'.

我的搖籃文件是:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    useLibrary 'org.apache.http.legacy' 
    defaultConfig { 
     applicationId "com.example.hp_pc.pnrstatus" 
     minSdkVersion 21 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    packagingOptions{ 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile files('libs/httpclient-4.3.6.jar') 
    compile files('libs/httpcore-4.3.3.jar') 
    compile files('libs/httpmime-4.3.6.jar') 
    // compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile 'com.android.support:design:25.1.0' 
    compile 'com.android.support.constraint:constraint-layout:+' 
    // compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' 
    testCompile 'junit:junit:4.12' 
} 

回答

3

在我的情況,我得到了同樣的錯誤,因爲拼寫錯誤的

compile files('lib/httpclient-4.3.6.jar') and solved by correcting the spelling to libs 

請正確檢查拼寫或者你可以試試這個

compile files('libs/httpclient-4.3.6.jar','libs/httpcore-4.3.3.jar','libs/httpmime-4.3.6.jar') 

PS:HttpClient被棄用而不推薦。請考慮OkHttp未來項目

1

我也有同樣的problem.just改變LIB和它的工作。 正確地檢查拼寫。