简体   繁体   English

将JAR文件添加到Android Studio项目时出错

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

I am trying to add the this jar file to my Android Studio project: 我正在尝试将此 jar文件添加到我的Android Studio项目中:

I did the necessary steps to add the jar as 'library'. 我做了必要的步骤,将罐子添加为“库”。 But build gives me the following error: 但是构建给我以下错误:

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>

I tried adding another jar file I downloaded from somewhere and that didn't give the error. 我尝试添加从其他地方下载的另一个jar文件,但没有给出错误。

Is this jar file corrupted or am I missing a dependency? 这个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')

}

I tried to add this jar file and successfully added without any error. 我尝试添加此jar文件并成功添加,没有任何错误。 I don't know how you add this file. 我不知道您如何添加此文件。 This is the process that I use to add this jar file : 这是我用来添加此jar文件的过程:

  1. Downloaded this project from github. 从github下载了这个项目。
  2. Extract the project and get jar file from libs folder. 解压缩项目并从libs文件夹获取jar文件。
  3. Now inside my project's libs folder, I simple paste this jar file. 现在,在项目的libs文件夹中,我只需粘贴此jar文件。
  4. In android studio, go to libs folder -> right click on imageviewtouch jar file -> add as library. 在android studio中,转到libs文件夹->右键单击imageviewtouch jar文件->添加为库。
  5. Done 完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM