JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
TargetSDKVersion:25
Cordova Android build broken after gradle dependencies update: Execution failed for task ‘:processDebugResources’. > com.android.ide.common.process.ProcessException: Failed to execute aapt
I recently ran the command “cordova build android” and gradle tried to download some dependecies:
Incremental java compilation is an incubating feature.
Download https://maven.google.com/com/android/support/support-v4/27.0.0/support-v4-27.0.0.pom
Download https://maven.google.com/com/android/support/customtabs/27.0.0/customtabs-27.0.0.pom
Download https://maven.google.com/com/android/support/support-compat/27.0.0/support-compat-27.0.0.pom
Download https://maven.google.com/com/android/support/support-media-compat/27.0.0/support-media-compat-27.0.0.pom
Download https://maven.google.com/com/android/support/support-core-utils/27.0.0/support-core-utils-27.0.0.pom
Download https://maven.google.com/com/android/support/support-core-ui/27.0.0/support-core-ui-27.0.0.pom
Download https://maven.google.com/com/android/support/support-fragment/27.0.0/support-fragment-27.0.0.pom
Download https://maven.google.com/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.pom
After that, at the end the build fails with this message:
ERROR: In FontFamilyFont, unable to find attribute android:font
ERROR: In FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In FontFamilyFont, unable to find attribute android:fontWeight
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':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.
[ERROR] An error occurred while running cordova run android (exit code 1)
I tried to find a solution but I didn’t find any post with this.
Any idea???
Remove platform/android then run Cordova build android again
Related
I am getting below exception when i build my flutter project on jenkins
C:\ProgramData\Jenkins\.jenkins\workspace\automated test app>flutter build apk
Building with sound null safety
Running Gradle task 'assembleRelease'...
Parameter format not correct -
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> Multiple task action failures occurred:
> A failure occurred while executing
com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\846e5094a0f0114af067375a609d094e\transformed\core-1.6.0\res\drawable-mdpi-v4\notification_bg_normal.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\846e5094a0f0114af067375a609d094e\transformed\core-1.6.0\res\drawable-mdpi-v4\notification_bg_low_normal.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\846e5094a0f0114af067375a609d094e\transformed\core-1.6.0\res\drawable-mdpi-v4\notification_bg_low_pressed.9.png: AAPT: error: file 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
BUILD FAILED in 1m 25s
Running Gradle task 'assembleRelease'... 86.2s
Gradle task assembleRelease failed with exit code 1
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
I am faced with this problem with Gitlab ci/Runner on Windows 10 and i stucked with all day.
The problem is that I have not installed Gitlab-Runner with privileges windows with my user account before :
cd C:\GitLab-Runner
.\gitlab-runner.exe install
.\gitlab-runner.exe start
But after, I installed Gitlab-Runner using my user account. The problems no longer occurs.
cd C:\GitLab-Runner
.\gitlab-runner.exe install --user ".\USERR" --password "MYPASSWORD"
.\gitlab-runner.exe start
So, I think maybe your problem is that you are not running the script with a privileges.
The fact that I saw this because when I tried to access the image file.
For example : C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\846e5094a0f0114af067375a609d094e\transformed\core-1.6.0\res\drawable-mdpi-v4\notification_bg_normal.9.png
I'm not able to reach the "C:\Windows\System32" without accepting the privileges administrator windows.
But if I accept as administrator, I can find the image file.
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{}],"original":"ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).\nerror: failed to create archive.\n\n ","tool":"AAPT"}
Task :app:mergeDebugNativeLibs
Task :app:mergeExtDexDebug
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).
error: failed to create archive.
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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
27 actionable tasks: 26 executed, 1 up-to-date
Can anyone help me to solve this problem...? please...
This is what happens when aapt fails to create an archive.
First make sure you are using the latest IDE and SDK. aapt for packaging is obsolete, and the earlier aapt2 has many bugs.
If they are up to date, try to check if the following processes on your computer have read/write access to the project directory.
[your android sdk path]\build-tools[your sdk version]\aapt.exe
[your android sdk path]\build-tools[your sdk version]\aapt2.exe
[your android studio path]\bin\studio64.exe
[your android studio path]\bin\fsnotifier64.exe
[your android studio path]\jre\bin\java.exe
[your android studio path]\jre\bin\javaw.exe
If you haven't set permissions manually, they are usually blocked by security software.
I recently ran into this problem and spent a lot of time finally found out that the security software on my workstation was not adding aapt2 and aapt to the allowed list for the project repository.
everyone, please help me. im running ionic cordova run android. then an error occured. before install plugin facebook4 things are going well, after instal the plugin im can not build or run android. i have running cordova clean and cordova build not solved my problem.
:app:transformClassesWithDesugarForDebug
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
42 actionable tasks: 40 executed, 2 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* 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 2m 49s
cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: E:\PROJECT\spectraapp\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* 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 2m 49s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --device exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Try removing platform and re-add it.
ionic cordova platform remove android
ionic cordova platform add android
then try
ionic cordova run android
If still have some issue
check it
solved. iam remove plugin facebook and add again with version #1.7.4
ionic cordova plugin add cordova-plugin-facebook4#1.7.4 --variable APP_ID="appid" --variable APP_NAME="appname"
add resource strings.xml in platforms/android/app/src/main/res/values/strings.xml
<string name="fb_app_id">appid</string>
<string name="fb_app_name">appname</string>
ionic cordova run android
I'm trying to set up firebase for both android and ios. I've tried using different versions in pubspec.yaml, but i'm still getting errors like this. Thanks for the help in advance.
FAILURE: Build failed with an exception.
*What went wrong: Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\13363\.gradle\caches\transforms-2\files-2.1\354fc33358371181aa1b0a8e262a9145\jetified-play-services-auth-16.0.1\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml:9: AAPT: error: resource drawable/googleg_standard_color_18 (aka com.example.catbox:drawable/googleg_standard_color_18) not found.
C:\Users\13363\.gradle\caches\transforms-2\files-2.1\354fc33358371181aa1b0a8e262a9145\jetified-play-services-auth-16.0.1\res\drawable-watch-v20\common_google_signin_btn_text_disabled.xml:16: AAPT: error: resource drawable/googleg_disabled_color_18 (aka com.example.catbox:drawable/googleg_disabled_color_18) not found.
C:\Users\13363\.gradle\caches\transforms-2\files-2.1\354fc33358371181aa1b0a8e262a9145\jetified-play-services-auth-16.0.1\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml:9: AAPT: error: resource drawable/googleg_standard_color_18 (aka com.example.catbox:drawable/googleg_standard_color_18) 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
BUILD FAILED in 21s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Finished with error: The plugin cloud_firestore could not be built due to the issue above.
I’m getting error when I'm trying to run on Android Device! I have no idea what is happening!
What can I do to solve it?
FAILURE: Build failed with an exception.
BUILD FAILED
Total time: 7.791 secs
* What went wrong:
Execution failed for task ':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.
Error: cmd: Command failed with exit code 1 Error output:
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:373: AAPT: Attribute "theme" already defined with incompatible format.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:359: AAPT: Original attribute defined here.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:373: error: Attribute "theme" already defined with incompatible format.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:359: Original attribute defined here.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':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.
[ERROR] An error occurred while running cordova run android (exit code 1).
Solved
Solved: Re-create the project and add the features again!
just put this code inside build.gradle on the last part
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
If you update the v4 v7 version to 26.0.0,
you also should change the CompileSdkVersion and BuildToolsVersion
to 26.0.0
Strange cause of this error for me was that I was missing a drawable from a layout. I copied the layout from another project and forgot to copy the drawable before running my project.
Also, check that the activity names in your layouts do not have spaces.
this problem comes from the mismatch project environment and executing platform environment.
try to create a new project and run in the same platform environment.
if its run, copy-paste old project src files.
$ ionic start
$ cd "project_name"
$ ionic cordova platform add android
$ ionic cordova run android
copy-paste old project src files