JaviMar
JaviMar

Reputation: 623

:app:compileDebugJavaWithJavac error: error reading C:\... \.android\build-cache\167256a7a343274ac6d230f06a5526cf83b55ac4\output\jars

Good day friends,

The error :app:compileDebugJavaWithJavac error: error reading C:\ .... \.android\build-cache\167256a7a343274ac6d230f06a5526cf83b55ac4\output\jars\classes.jar; error in opening zip file and also the same but ending in cannot read zip file

occurs when running the application. After that, I get all sorts of errors obviously such as package android.support.v7.app does not exist etc.

I have tried cleaning, rebuilding, cleaning the .android\build-cache etc, etc, and nothing. I have also looked at the other answers provided here, but none of them fixed this issue.

I am running jdk1.8.0_40 as JDK

This is my top gradle:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}

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

and my app gradle:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.3"
        defaultConfig {
            applicationId "es.sample.android.myoffice"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'
        }

        repositories {
            mavenLocal()
            flatDir {
                dirs 'libs'
            }
        }
        apply plugin: 'android-apt'
    }

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

        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:design:25.3.1'
        compile 'com.android.support:recyclerview-v7:25.3.1'
        compile 'com.android.support:cardview-v7:25.3.1'
        compile 'com.android.support:palette-v7:25.3.1'

        compile 'com.google.firebase:firebase-config:10.0.1'
        compile 'com.google.firebase:firebase-messaging:10.0.1'
        compile 'com.google.firebase:firebase-auth:10.0.1'
        compile 'com.google.android.gms:play-services-auth:10.0.1'
        compile 'com.google.android.gms:play-services-appinvite:10.0.1'
        compile 'com.firebase:firebase-jobdispatcher:0.5.2'

        compile 'com.jakewharton:butterknife:8.4.0'
        apt 'com.jakewharton:butterknife-compiler:8.4.0'
        compile 'com.squareup.okhttp3:okhttp:3.6.0'
    }
    apply plugin: 'com.google.gms.google-services'

Thanks!

NEW EDIT

Apparently is only affecting to:

Error:(18, 30) error: package android.support.v7.app does not exist

Upvotes: 0

Views: 673

Answers (1)

JaviMar
JaviMar

Reputation: 623

After going crazy and trying everything that I could, I came up with a solution.

I had go back to Android Support Library version 45. For some strange reason, version 46 was causing all this mess for android.support.v7.app

So do the following:

  1. Download the version here and unzip it to a local place in your computer
  2. Go to your m2repository in your SDK root folder .. /extras/android and delete it
  3. Cut previously unzipped m2repository folder and paste it to previous location
  4. Clean and run your app

Upvotes: 1

Related Questions