Execution failed for task ':app:mockableAndroidJar' - android

I am using local gradle of version 2.4 and IntelliJ IDEA 14.1.3
When I run project from IntelliJ it runs fine but when execute gradle clean build command from command line it gives the flowing exception and build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mockableAndroidJar'.
> java.util.zip.ZipException: invalid entry compressed size (expected 2051 but got 2050 bytes)

This looks like an old ques which is not yet answered yet.
I got into same problem, when my jar files could not be read by Android Studio and it gave me the above mentioned error.
Taking lead from the comment by -Mikhail Boyarsky I changed classpath in build.gradle file to 'com.android.tools.build:gradle:2.2.3'.
Synced project and it started working.

I solved it by changing com.android.tools.build:gradle:2.3.0 version to 2.2.3, then build it with another exception and then I changed the version back to 2.3.0.
Not sure how it works, looks like a gradle bug.

Related

Flutter Android build not generating in Mac

In Mac, I've setup Flutter in Android studio. When I'm running project it gives me error
* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
I'm using all latest versions of Flutter, Kotlin, Gradle etc.
You need to equalize kotlin version in first row which is ext.kotlin_version = '1.6.10' to according to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" of underlined $kotlin_version
After this, the problem will solve...
Actually I found a solution for my problem. There are 2 dependency defined in .yaml file 1. geo_location and 2. location.
After removing the location dependency from .yaml file and run command flutter pub get I can successfully build android build from Mac. This solution might not be global but solution of my problem I found this.
Thank you!
Happy coding.

Plugin intercom update to latest version cordova error at build/run

I want to update plugin intercom to latest version. I am using cordova version 9.0.0
For iOS works fine, but to update intercom for android I must have the version of platform >= 9.0.0
I updated from version 7.1.1 to 9.0.0 (android platform), but I got 2 errors. I think that is gradle cause these errors... Because I tried to make another fresh cordova project to see if everything works fine... but application does not run/build.
The text of errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Script '..\platforms\android\cordova-plugin-intercom\be-intercom.gradle' line: 46
What went wrong:
A problem occurred evaluating script.
Could not find method execute() for arguments [] on task ':app:copyGoogleServices' of type org.gradle.api.tasks.Copy.
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle
I have google-services.json (in root).
Everything works fine before this update.
In ..\platforms\android\cordova-plugin-intercom\be-intercom.gradle at line 46 is tasks.copyGoogleServices.execute().
The solution is to replace the execute() with finalizedBy() in platforms\android\cordova-plugin-intercom\be-intercom.gradle and to copy google-services.json in platforms\android\app.
https://medium.com/#olku/gradle-5-0-broken-api-of-the-exec-task-5b2d76c8d121

compileReleaseJavaWithJavaC failed for react native modules when building a release build

Task :react-native-device-info:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
java.io.FileNotFoundException: /workspace/eos-native/node_modules/react-native-device-info/android/build/intermediates/annotation_processor_list/release/annotationProcessors.json (No such file or directory)
The error makes sense , and the file is not there, but I have no idea why its not there? It is created when I run a debug version of the app and debug versions of my libraries, react-native-device-info, react-orientation-locker etc.. I've cleaned, gradle synched, rebuilt etc. but when trying to assemble or install a release build I get this error within seconds. What is causing the Java
I had the same problem in an android project (without react) when I added a library module.
After searching for a solution for quite some time, I finally deleted the .gradle directory in the project root folder.
This solved the problem for me.
update android gradle plugin to 3.3
update gradle to 4.10.3
fixed the issue for me.

:app:transformDexArchiveWithDexMerger IllegalStateException using AS 3.0 beta6

I've started getting following error after updating to AS 3.0 beta 6. Has anyone else come across this? I'm only seeing this error when I try to build/run from AS.....no issue if I run gradle on command line.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerFor<BuildVariantName>Debug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalStateException
Thanks to #Nabin in the comments we found out that enabling Instant Run fix that issue.
Unfortunately - other than the original poster - we had the same issue on the command line. Which means our CI doesn't run.
We found out that we can disabling the incremental dexing by setting the flag -Pandroid.useDexArchive=false. See here for more infos:
A new incremental dexing pipeline has been implemented. Now the Gradle plugin dex only the class files that have changed. It is enabled by default, but you can disable it by doing one of the following:
Passing -Pandroid.useDexArchive=false when running builds from command line e.g. ./gradlew :app:assembleDebug -Pandroid.useDexArchive=false.
Adding android.useDexArchive=false to the gradle.properties file in your root project.
Luckily we don't need incremental dexing on our CI.
Unfourtnaly it doesn't help us in Android Studio with disabled Instant Run!

Gradle Android task crashing with unclear error

I am trying to run a Gradle Android task generated by libGDX utility (the desktop task runs fine) in IntelliJ IDEA, but I'm only getting this nonspecific error message. What is the issue, or where are the logs, or how to enabled logs?
Information:Gradle: Executing tasks: [:core:assemble, :android:assembleDebug]
Information:24. 10. 2015 16:58 - Compilation completed with 1 error and 0 warnings in 9s 415ms
Error:Gradle: Execution failed for task ':android:proguardDebug'.
> java.io.IOException: Please correct the above warnings first.
PS: Not sure if it is relevant, but I have modified build files and ProGuard file to support Scala as described there.
I did not find a way of getting any useful logs from IntelliJ IDEA. I solved the problem by running Gradle from console.
gradlew assemble --stacktrace --info
Problem was Gradle could not find tools.jar. Adding system environment variable JAVA_HOME pointing to Java SDK directory fixed the issue.

Categories

Resources