C:\src\flutter\bin\flutter.bat – no-color build apk
Waiting for another flutter command to release the startup lock...
You are building a fat APK that includes binaries for android-arm, android-ARM64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle – target-platform android-arm, android-ARM64, android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk – target-platform android-arm, android-ARM64, android-x64 – split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
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.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-Firebase\Android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-Firebase\Android\app\src\main\res\mipmap-mdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\mysel\AndroidStudioProjects\Chatting-app-with-firebase\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: AAPT: error: file failed to compile.
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 16s
Running Gradle task 'assembleRelease'... 80.3s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
✏️ Creating android\settings_aar.gradle...
[!] Flutter tried to create the file android\settings_aar.gradle, but failed.
To manually update settings.gradle, follow these steps:
Copy settings.gradle as settings_aar.gradle
Remove the following code from settings_aar.gradle:
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
Please create the file and run this command again.
Process finished with exit code 1
Tried changing daemon in build.properties file, tried Invalidate cache/restart but nothing seems to work
Related
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':screen:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:168: error: resource android:attr/fontStyle not found.
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:169: error: resource android:attr/font not found.
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:170: error: resource android:attr/fontWeight not found.
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:171: error: resource android:attr/fontVariationSettings not found.
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:172: error: resource android:attr/ttcIndex not found.
error: failed linking references.
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 7m 3s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 425.8s (!)
Gradle task assembleRelease failed with exit code 1
mitto#Titos-MacBook-Pro solutech-sat % flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'... Removed unused resources: Binary resource data reduced from 1194KB to 1134KB: Removed 5%
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':screen:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:168: error: resource android:attr/fontStyle not found.
/Users/mitto/Projects/Solutech/apps/solutech-sat/build/screen/intermediates/res/merged/release/values/values.xml:169: error: resource android:attr/font not found.
/Users/mitto/Projec
You need to generate bundles instead of apk.
flutter build appbundle
check this doc : https://docs.flutter.dev/deployment/android#build-an-app-bundle
My app works fine when I run it or build app packages, but when I try to build apk for release or profile, it gives this message:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':background_location:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:C:\Users\Misha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\background_location-0.6.1\android\src\main\AndroidManifest.xml:10:9-15:37: AAPT: error: attribute android:foregroundServiceType not found.
I've already tried flutter clean and flutter pub cache repair, as well as updated my Gradle version. Also, I have AndroidX enabled.
Could somebody please help?
Update: I found a solution here
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.
Launching lib\main.dart on sdk gphone x86 in debug mode...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\ASUS\Documents\bookingapp\Fook\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\ASUS\Documents\bookingapp\Fook\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hi\values-hi.xml: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\ASUS\Documents\bookingapp\Fook\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-de\values-de.xml: AAPT: error: file failed to compile.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\ASUS\Documents\bookingapp\Fook\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lo\values-lo.xml: AAPT: error: file failed to compile.
finally found the problem it was my antivirus that was restricting AAPT to execute and make change in protected folder
Disable File Safeguard
Allow AAPT to Execute
Try a clean build:
flutter clean
Then try running on another device:
flutter run -d DeviceName --release
If you do not need to debug, but you still need logs then a release configuration or a profile config should work for you --profile
I am facing issue with making APK in flutter from vs code.
Command which I use to make APK.
flutter build apk --split-per-abi
I tried most of solutions like check AndroidX compatibility, Flutter Clean, pub get , pub update etc.
Still I am getting below error in vs code as well android studio,
Please someone help me in this process, where I am missing something.
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':speech_recognition:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/company/.gradle/caches/transforms-2/files-2.1/fc785d3673ca7ec4009108d2721750b3/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontStyle not found.
/Users/company/.gradle/caches/transforms-2/files-2.1/fc785d3673ca7ec4009108d2721750b3/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/font not found.
/Users/company/.gradle/caches/transforms-2/files-2.1/fc785d3673ca7ec4009108d2721750b3/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontWeight not found.
/Users/company/.gradle/caches/transforms-2/files-2.1/fc785d3673ca7ec4009108d2721750b3/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/company/.gradle/caches/transforms-2/files-2.1/fc785d3673ca7ec4009108d2721750b3/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex 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 2m 49s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 170.8s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
✏️ Creating `android/settings_aar.gradle`...
[!] Flutter tried to create the file `android/settings_aar.gradle`, but failed.
To manually update `settings.gradle`, follow these steps:
1. Copy `settings.gradle` as `settings_aar.gradle`
2. Remove the following code from `settings_aar.gradle`:
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
Please create the file and run this command again.
For Debug APK :
flutter build apk
For Release APK :
flutter build apk --release
For App Bundle :
flutter build appbundle