I am getting errors in android studio, I tried all the possible steps but nothing helped me.
[Android Gradle Plugin Version 4.2.2, Gradle Version:7.2-rc-2 and JDK 15.0.2
Error Log File
Executing tasks: [clean, :app:assembleDebug] in project C:\Users\asrar\Desktop\Smart GIT
Task :clean UP-TO-DATE
Task :app:clean
Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:generateDebugBuildConfig
Task :app:javaPreCompileDebug
Task :app:checkDebugAarMetadata
Task :app:generateDebugResValues
Task :app:generateDebugResources
Task :app:processDebugGoogleServices
Task :app:createDebugCompatibleScreenManifests
Task :app:extractDeepLinksDebug
Task :app:mergeDebugResources
Task :app:processDebugMainManifest
Task :app:processDebugManifest
Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
Task :app:mergeDebugShaders
Task :app:compileDebugShaders NO-SOURCE
Task :app:generateDebugAssets UP-TO-DATE
Task :app:mergeDebugAssets
Task :app:compressDebugAssets
Task :app:processDebugJavaRes NO-SOURCE
Task :app:mergeDebugJavaResource FAILED
Task :app:checkDebugDuplicateClasses FAILED
Task :app:processDebugManifestForPackage
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
newPosition < 0: (-1 < 0)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform work-runtime-2.5.0.aar (androidx.work:work-runtime:2.5.0) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarToClassTransform: C:\Users\asrar.gradle\caches\modules-2\files-2.1\androidx.work\work-runtime\2.5.0\b878e75e14ee7e745fe120bc78e8db8995064f4d\work-runtime-2.5.0.aar.
> zip END header not found
Failed to transform concurrent-futures-1.1.0.jar (androidx.concurrent:concurrent-futures:1.1.0) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=7, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for EnumerateClassesTransform: C:\Users\asrar.gradle\caches\transforms-3\a51d8e3d972cee1891837c926b3ae865\transformed\jetified-concurrent-futures-1.1.0.jar.
> zip END header not found
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2-rc-2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 34s
18 actionable tasks: 17 executed, 1 up-to-date
Stacktrace and info is not a solution, just gives you more information about what went wrong.
Seems really similar to IntelliJ Compilation Error zip END header not found
Which suggests your gradle cache is corrupted. Try clearing it. folder: $HOME/.gradle/caches
Probably there are some corrupted files.
For me invalidating caches and restart worked.
Last option here:
The versions you're using for plugin version and Gradle are not compatible. According to https://developer.android.com/studio/releases/gradle-plugin?
For Gradle Version 7.2 you need at least 7.1 Plugin version
Related
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
> Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
> Could not resolve io.realm:realm-annotations-processor:10.0.1.
Required by:
project :app
> Could not resolve io.realm:realm-annotations-processor:10.0.1.
> Could not get resource 'https://jcenter.bintray.com/io/realm/realm-annotations-processor/10.0.1/realm-annotations-processor-10.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/io/realm/realm-annotations-processor/10.0.1/realm-annotations-processor-10.0.1.pom'. Received status code 502 from server: Bad Gateway
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
2 actionable tasks: 1 executed, 1 up-to-date
Does anyone know how to fix these problems? And below is the image for my build.gradle.
build.gradle project :
build.gradle App :
2 & 3
Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:javaPreCompileDebug UP-TO-DATE
Task :app:mainApkListPersistenceDebug UP-TO-DATE
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
Could not download aapt2-windows.jar (com.android.tools.build:aapt2:3.6.3-6040484): No cached version available for offline mode
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 258ms
5 actionable tasks: 1 executed, 4 up-to-date
Try Build -> Clean Project.
Than File -> Invalidate caches/Restart.
Than open the project and sync it.
I faced the same error. fixed by
Deleting the caches folder inside bin of the .gradle folder which android studio uses found in File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle User Home
Deleting .gradle folder in project.
Deleting the Build folder in project.
Invalidate cache/ and restart
Rebuild project and done! it works
Ps1: Steps 2 and 3 can be done in projects tab, top left side of android studio.
Ps2: DON'T WORRY ABOUT DELETING THOSE FOLDERS, gradle will download them for you in the next build, provided you have network connection and Offline mode in gradle tab (top right side) is off.
When running the cordova build android command i get this error.
Execution failed for task ':app:mergeDebugResources'.
When i tried running this command a few days ago it made the apk, but now it won't anymore. i didn't change anything either
i tried running ionic cordova resources again so that maybe it wouldn't chrash on the image again
Does anyone else have this issue? What causes this?
full stacktrace:
PS C:\school\pokemontest> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Gebruiker\AppData\Local\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest UP-TO-DATE
> Task :CordovaLib:processDebugManifest UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript UP-TO-DATE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :CordovaLib:compileDebugRenderscript UP-TO-DATE
> Task :CordovaLib:generateDebugBuildConfig UP-TO-DATE
> Task :CordovaLib:generateDebugResValues UP-TO-DATE
> Task :CordovaLib:generateDebugResources UP-TO-DATE
> Task :CordovaLib:packageDebugResources UP-TO-DATE
> Task :CordovaLib:generateDebugRFile UP-TO-DATE
> Task :CordovaLib:prepareLintJar UP-TO-DATE
> Task :CordovaLib:generateDebugSources UP-TO-DATE
> Task :CordovaLib:javaPreCompileDebug UP-TO-DATE
> Task :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> C:\school\pokemontest\platforms\android\app\src\main\res\drawable-pioort-xhdpi: Error: Invalid resource directory name
> Task :app:mergeDebugResources FAILED
C:\school\pokemontest\platforms\android\app\src\main\res\drawable-pioort-xhdpi: Error: Invalid resource directory name
20 actionable tasks: 1 executed, 19 up-to-date
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
C:\school\pokemontest\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> C:\school\pokemontest\platforms\android\app\src\main\res\drawable-pioort-xhdpi: Error: Invalid resource directory name
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
After a lot of tries, I fix this issue by doing
1- Open the config.xml
2- Change xmlns="http://www.w3.org/ns/widgets" of the widget tag to xmlns:android="http://schemas.android.com/apk/res/android"
3- Rebuild the project
I fixed the problem.
I deleted the plugin and platform map.
After that i ran the commands cordova prepare for the plugins
and cordova build android to set everything up again.
You can try running command cordova clean android && cordova build android.
> Executing tasks: [:app:assembleDebug]
>
> WARNING: The option 'android.enableAapt2' is deprecated and should not
> be used anymore. Use 'android.enableAapt2=true' to remove this
> warning. It will be removed at the end of 2018. :app:preBuild
> UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl
> UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE
> :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig
> UP-TO-DATE :app:prepareLintJar UP-TO-DATE
> :app:mainApkListPersistenceDebug UP-TO-DATE
> :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources
> UP-TO-DATE :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
> BUILD FAILED in 13s 9 actionable tasks: 1 executed, 8 up-to-date
In gradle.properties change android.enableAapt2=false to true
You can actually have problems in the resources but these will not be displayed if you do not correct this problem first:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2 = true' to remove this warning. It
will be removed at the end of 2018.
within your gradle.properties file that is located in the root of the project, replace:
android.enableAapt2
with:
android.enableAapt2 = true
Try updating your gradle plugin. Fixed my error.
within gradle.properties file that is located in the root of the project,
I have just commented on this line, now works perfectly
android.enableAapt2 = true
Please make sure that the images and icons you included in your project is Imported by android studio or Drawable importer plugin.
to install this plugin you have to go File>setting> plugin.
then type Drawable importer
Your problem is with android.enableAapt2 .
You should check what's missing or the package is imported correctly.
Search for file android.enableAapt2 or that keyword.
I created a new project in Android Studio 3.0.1 and during the build process I am getting aapt2 exceptions. Disabling aapt2 is an option but I want to understand why aapt2 is failing to build.
Let me know if any additional details are required
Gradle Console Output:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Console output with --info flag:
AAPT warning(1028621614), Job(QueuedJob{
title=Compiling values.xml,
task={from=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml, to=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\res\merged\debug},
future=com.google.common.util.concurrent.SettableFuture#7d83ce1d}): Done
Exception while processing job : QueuedJob{
title=Compiling values.xml,
task={from=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml, to=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\res\merged\debug},
future=com.google.common.util.concurrent.SettableFuture#7d83ce1d} : com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Process (412248382) processed 0 files
Thread(queued-resource-processor_54): Process(412248382), after shutdown queue_size=2
Slave 1566465306 is ready
Process (197581388) processed 0 files
Thread(queued-resource-processor_55): Process(197581388), after shutdown queue_size=2
Process (1933852165) processed 1 files
Thread(queued-resource-processor_53): Process(1933852165), after shutdown queue_size=1
Process (1566465306) processed 0 files
Thread(queued-resource-processor_56): Process(1566465306), after shutdown queue_size=0
Shutdown finished in 9ms
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
:app:mergeDebugResources (Thread[Task worker for ':',5,main]) completed. Took 0.561 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
7 actionable tasks: 1 executed, 6 up-to-date
Edit:
Full Gradle Output:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'D:\AndroidSDK\add-ons\addon-google_apis-google-19-1' (Expected 'D:\AndroidSDK\add-ons\addon-google_apis-google-19')
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'D:\AndroidSDK\add-ons\addon-google_apis-google-19-1' (Expected 'D:\AndroidSDK\add-ons\addon-google_apis-google-19')
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
values_values.arsc.flat: error: failed to open.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:prepareLintJar UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:transformNativeLibsWithStripDebugSymbolForDebug
:app:processDebugJavaRes NO-SOURCE
:app:validateSigningDebug
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
18 actionable tasks: 11 executed, 7 up-to-date
The simple solution has to do with folder permissions. I discovered the answer after a lot of digging through the stacktrace output and learning more about the Java exception.
Move your Development/Project folder to a location that gives write accesss to android studio/gradle.