error: failed linking file resources. without any message to error - android

I got this error
error: failed linking file resources.
But with no info about error
also, gradle tasks was not found.

Solution is to use
./gradlew build --stacktrace
with terminal this will build app and will show your error

Related

FAILURE: Build failed with an exception. - Android

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.

Android, flutter errror : Execution failed for task ':app:mergeDebugResources'

I got an error when I installed Google-play Services tool, What is the problem? I googled and searched for a long time, but I couldn't know what is the problem.
Below is the error message
use registerGeneratedFolders(FileCollection) registerResGeneratingTask
is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use
registerGeneratedFolders(FileCollection)
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-xxhdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_text_disabled.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-hdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-xhdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\layout-v21\notification_template_custom_big.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_text_dark_normal.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-mdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\drawable-xhdpi-v4\notification_bg_low_pressed.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_text_dark.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-hdpi-v4\common_full_open_on_phone.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-mdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-media-compat-26.1.0.aar\f6856f0a6bf11837b0484543a04fb51a\res\layout\notification_template_big_media.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\drawable-v21\notification_action_background.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\drawable\notification_bg.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-xhdpi-v4\googleg_disabled_color_18.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\layout-v21\notification_template_icon_group.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-hdpi-v4\common_google_signin_btn_text_light_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\18d5967141a97e1c47095b347e0363df\res\drawable\notification_tile_bg.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-hdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-hdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable-xxhdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png: error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_text_light.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_icon_light_normal.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\drawable\common_google_signin_btn_icon_dark_normal.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\support-media-compat-26.1.0.aar\f6856f0a6bf11837b0484543a04fb51a\res\layout\notification_template_big_media_custom.xml:
error: file not found.
C:\Users\?????.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\93c2774cf3ab39eadc13fc662c2d7b36\res\color\common_google_signin_btn_tint.xml:
error: file not found.
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 13s Finished with error: Gradle build failed: 1
The issue was likely caused by the outdated google-services version configured in the Android build. What you can do here is update the Firebase plugins that you're using and run flutter clean and flutter pub get to update the installed plugins and index. If that didn't solve the issue, you can delete the /android build folder and generate a new one by running flutter create --platforms=android in the Terminal.

Cordova build android:':app:mergeDebugResources'. failing in Jenkins

After updating the android studio, gradle version and Cordova (incl. platforms) for hybrid project in windows 10 recently, i got this error in Jenkins.
:app:mergeDebugResourcesC:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.4.0.aar\76d6a769daf730ed767830374ebcd3bd\res\drawable\abc_btn_colored_material.xml: error: file not found.
...
...
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
: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.
I searched for a solution for this which should be dynamical and can be managed through Jenkins itself since it is not possible to edit individual platform files.
Originally the error was
Execution failed for task ':mergeDebugResources'.
> Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file
which was caused by
Error: File path too long on windows, keep below 240 characters
Workaround for this was to change workspace folder so it is coming to a top level. (eg: C:/Users/[youruser]/yourfolder. Check the link here
Note
I added this question and the answer, for the self reference in future and to assist someone who is working with Jenkins.
The answer is a simple tweak. Go to
Manage Jenkins --> Configure System --> Global Properties
add an Environment variable
name = GRADLE_USER_HOME
value = C:\Users\[youruser]\devGradle
create a folder "devGradle" (or give it any name) if it is not created already.
The Gradle build script will look for this environment variable and then use the specified directory as the Gradle home directory and will build the project

Cordova Android build broken after gradle dependencies update issue

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

com.android.ide.common.process.ProcessException: Failed to execute aapt! What can I do?

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

Categories

Resources