Malik
Malik

Reputation: 97

Error adding a JAR file to Android Studio project

I am trying to add the this jar file to my Android Studio project:

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.

Is this jar file corrupted or am I missing a dependency?

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')

}

Upvotes: 0

Views: 2138

Answers (1)

Ruchir
Ruchir

Reputation: 1122

I tried to add this jar file and successfully added without any error. I don't know how you add this file. This is the process that I use to add this jar file :

  1. Downloaded this project from github.
  2. Extract the project and get jar file from libs folder.
  3. Now inside my project's libs folder, I simple paste this jar file.
  4. In android studio, go to libs folder -> right click on imageviewtouch jar file -> add as library.
  5. Done

Upvotes: 2

Related Questions