Ionic : Execution failed for task ':app:mergeDebugResources' - android

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.

Related

Could not resolve all files for configuration error with gradle on Android Studio

> 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

Cause: newPosition < 0: (-1 < 0) in Android Studio

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

Android Studio Gradle build error- Task :app:packageInstantRunResourcesDebug FAILED

I am new to android studio and Gradle. I have a project where I am loading a large SQLite database (from assets folder). When I press run and select an emulator, android studio starts on the build and executes gradle tasks. I am getting an error on one of these tasks which says:
Error:Execution failed for task ':app:packageInstantRunResourcesDebug'.
> org.gradle.tooling.BuildException (no error message)
and in the complete error output in console it says this:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageInstantRunResourcesDebug'.
> org.gradle.tooling.BuildException (no error message)
* 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 21s
I don't know if this is due to the large database. This is the stack trace of the tasks being built:
Executing tasks: [:app:assembleDebug]
:app:buildInfoDebugLoader
: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:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:packageInstantRunResourcesDebug FAILED
:app:buildInfoGeneratorDebug
You need to disable Instant Run feature. Instruction for latest stable Android Studio:
File -> Settings -> Build, Execution, Deployment -> Instant Run -> [Remove checkbox] ""Enable Instant Run to hot sap code...""

Can someone give me a better understanding of this error? Error:Execution failed for task ':app:processDebugResources'

Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
I recently updated my version of android studio, when i create an activity now i get this error. Can someone explain this error to me?
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\eche\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library
:app:prepareComAndroidSupportConstraintConstraintLayout101Library
:app:prepareComAndroidSupportDesign2310Library
:app:prepareComAndroidSupportRecyclerviewV72310Library
:app:prepareComAndroidSupportSupportV42310Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
AGPBI: {"kind":"error","text":"No resource identifier found for attribute \u0027srcCompat\u0027 in package \u0027com.drawscape.drawscape\u0027","sources":[{"file":"C:\Users\eche\Documents\Drawscape 2.05\app\src\main\res\layout\activity_adminoptions.xml","position":{"startLine":24}}],"original":"","tool":"AAPT"}
C:\Users\eche\Documents\Drawscape 2.05\app\build\intermediates\res\merged\debug\layout\activity_adminoptions.xml:25: error: No resource identifier found for attribute 'srcCompat' in package 'com.drawscape.drawscape'
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.875 secs

Android Studio AVD is not launching

Hi I have installed the latest version of Android Studio on Windows 7 32-bit.
I have created a welcome app, but when I try to test it using AVD it's not launching, instead it's showing the error below:
Executing tasks: [:app:assembleDebug, :app:assembleDebugTest]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72102Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugJava
:app:preDexDebug
The system cannot find the path specified.
The system cannot find the path specified.
FAILED
The system cannot find the path specified.
The system cannot find the path specified.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\Android\AndroidStudio\sdk\build-tools\21.1.1\dx.bat --dex --output E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\pre-dexed\debug\classes-0f52de9bbc91bb9956813aaf2c6f0ff9d0160fa0.jar E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.2\classes.jar
Error Code: 1
Output: The system cannot find the path specified.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 24.154 secs
**Failed to complete Gradle execution
Cause:**
Does anyone know how to fix this?

Categories

Resources