Error:Execution failed for task ':app:packageDebug'. > !zip.isFile()

蹲街弑〆低调 提交于 2020-05-24 21:10:10

问题


@UPDATE

Thank you very much. Now at least there are no errors. But it's still a far cry from how it worked before - how it should work. Now, the database looks ... strange. I think that something is still wrong with this gradle.

It should not look like. According to the java code in the database will be user and its data (name, email, date of account creation, id avatar)

In the application at the site next to the avatar you should display the name. Unfortunately, as you can see nothing happens. There is nothing wrong with the code because it previously worked. :(


I ruined my project! I tried to fix it but now it's worse than it was.

The project is chat client through Firebase.

It started when I deleted my base. I had too many test users, messages I wanted to clear it. Since then, it gets a million error notifications - trying to fix one thing leads to even worse errors.

I tried to connect to the application completely different base, I tried to re-arrange a few things. Nothing helps.

At first I thought that the problem is with wrong compile 'com.google.firebase:firebase-database:9.8.0' number. Then I received

E/FirebaseApp: Firebase API initialization failure.

I try to fix it. Application was started and in the database was very strange things.

Now i get

Error:Execution failed for task ':app:packageDebug'.> !zip.isFile()

build.gradle (project)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

    }
}

build.gradle (module:app)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.rachel.komunikator"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.google.firebase:firebase-database:9.8.0' 
    compile 'com.google.firebase:firebase-auth:9.8.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'
    testCompile 'junit:junit:4.12'
}

Google Play Services on my emulator

Im using: Android Studio 2.2.3 and Nexus 5X Emulator

@UPDATE

W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found. E/FirebaseApp: Firebase API

initialization failure. D/FirebaseApp:

com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.

all logs:

W/System: ClassLoader referenced unknown path: /data/app/com.example.rachel.komunikator-2/lib/x86

          [ 02-02 20:56:04.988  1566: 1589 D/         ]
          HostConnection::get() New Host Connection established 0x8cf20100, tid 1589
I/InstantRun: Instant Run Runtime started. Android package is com.example.rachel.komunikator, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/com.example.rachel.komunikator-2/lib/x86
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
E/FirebaseApp: Firebase API initialization failure.
               java.lang.reflect.InvocationTargetException
                   at java.lang.reflect.Method.invoke(Native Method)
                   at com.google.firebase.FirebaseApp.zza(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                   at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
                   at android.app.ActivityThread.-wrap2(ActivityThread.java)
                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
                   at android.os.Handler.dispatchMessage(Handler.java:102)
                   at android.os.Looper.loop(Looper.java:154)
                   at android.app.ActivityThread.main(ActivityThread.java:6119)
                   at java.lang.reflect.Method.invoke(Native Method)
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/com.example.rachel.komunikator/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_8eee9db5e99a0da2dcdc7b52647c81db3aed29e6-classes.dex)
                   at com.google.firebase.iid.zzg.zzeC(Unknown Source)
                   at com.google.firebase.iid.zzg.<init>(Unknown Source)
                   at com.google.firebase.iid.zzg.<init>(Unknown Source)
                   at com.google.firebase.iid.zzd.zzb(Unknown Source)
                   at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.google.firebase.FirebaseApp.zza(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1751) 
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1726) 
                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                   at android.app.ActivityThread.installProvider(ActivityThread.java:5853) 
                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 
                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 
                   at android.app.ActivityThread.-wrap2(ActivityThread.java) 
                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                   at android.os.Looper.loop(Looper.java:154) 
                   at android.app.ActivityThread.main(ActivityThread.java:6119) 
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
E/FirebaseApp: Firebase API initialization failure.
               java.lang.reflect.InvocationTargetException
                   at java.lang.reflect.Method.invoke(Native Method)
                   at com.google.firebase.FirebaseApp.zza(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                   at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
                   at android.app.ActivityThread.-wrap2(ActivityThread.java)
                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
                   at android.os.Handler.dispatchMessage(Handler.java:102)
                   at android.os.Looper.loop(Looper.java:154)
                   at android.app.ActivityThread.main(ActivityThread.java:6119)
                   at java.lang.reflect.Method.invoke(Native Method)
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                Caused by: java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/data/com.example.rachel.komunikator/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.8.0_b60271da061b8a83af31355011409573bfa72cef-classes.dex)
                   at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
                   at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.google.firebase.FirebaseApp.zza(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1751) 
                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1726) 
                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                   at android.app.ActivityThread.installProvider(ActivityThread.java:5853) 
                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 
                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 
                   at android.app.ActivityThread.-wrap2(ActivityThread.java) 
                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                   at android.os.Looper.loop(Looper.java:154) 
                   at android.app.ActivityThread.main(ActivityThread.java:6119) 
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

回答1:


Clean and Rebuild project should work. It work for me. Look at this: https://code.google.com/p/android/issues/detail?id=230211




回答2:


Regarding this:

Error:Execution failed for task ':app:packageDebug'.> !zip.isFile()

I solved it by deleting the build project and running again.

Hope this helps.




回答3:


Its very simple just run ./gradlew clean

If you are using Cordova or Ionic Framework run following commands

cd platforms/android
./gradlew clean

Its easy fix.




回答4:


I met this problems just A few minutes ago, I tried some ways in this question, but it's not work. So I asked other programmers for help, then it worked!

It's very easy! just do it as the figure shows below.

First Step

Second Step

I hope that would help you.




回答5:


Just disable Instant Run:

Android Studio -> Preferences -> Instant Run



回答6:


Move this line to the BOTTOM of your module:app build.gradle:

apply plugin: 'com.google.gms.google-services'

Example in the Setup Guide.




回答7:


According to this, try to use the new version of gradle : 2.3.0

This issue has been fixed in ag/I6a6ef1a95732118b8e330b64fe4389710a3a2657. Please use newer gradle plugin 2.3.0-beta2 or, if using 2.2.x, disable new packaging by using the "android.useOldPackaging=true" flag.




回答8:


You are missing the core firebase lib.

Add compile 'com.google.firebase:firebase-core:9.8.0'




回答9:


I solve this question.i just change my gradle version from 2.2.3 to 2.2.2 classpath 'com.android.tools.build:gradle:2.2.2'




回答10:


In my case, I clicked the rebuild icon (its guide: "sync project with gradle file") and it solved the problem




回答11:


I use Cordova CLI and have run into this issue from time-to-time. Given that I build locally on my Windows 10 computer user permissions is not the issue. I found that from time to time Cordova simply deletes the android/builds folder and then is for some reason unable to create it. I simply recreate that folder manually and all is hunkry-dory.




回答12:


Right click on root of the project ex:app select>>Show in Explorer and delete .gradle file and click on the clean OR Built option it will work 100%.



来源:https://stackoverflow.com/questions/42010416/errorexecution-failed-for-task-apppackagedebug-zip-isfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!