簡體   English   中英

將JAR文件添加到Android Studio項目時出錯

[英]Error adding a JAR file to Android Studio project

我正在嘗試將此 jar文件添加到我的Android Studio項目中:

我做了必要的步驟,將罐子添加為“庫”。 但是構建給我以下錯誤:

Error:error reading C:\Users\Malik\AndroidStudioProjects\test6\app\libs\imageviewtouch.jar; error in opening zip file
tion timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>

我嘗試添加從其他地方下載的另一個jar文件,但沒有給出錯誤。

這個jar文件是否已損壞,或者我缺少依賴項?

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.greenbergc.test6"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile files('libs/about-0.2.1.jar')
    compile files('libs/imageviewtouch.jar')

}

我嘗試添加此jar文件並成功添加,沒有任何錯誤。 我不知道您如何添加此文件。 這是我用來添加此jar文件的過程:

  1. 從github下載了這個項目。
  2. 解壓縮項目並從libs文件夾獲取jar文件。
  3. 現在,在項目的libs文件夾中,我只需粘貼此jar文件。
  4. 在android studio中,轉到libs文件夾->右鍵單擊imageviewtouch jar文件->添加為庫。
  5. 完成

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM