I'm trying to build apk with flutter. But everytime i run flutter build apk
or flutter build apk --release
Build always failed with an exception like this.
Running Gradle task 'assembleRelease'...
Removed unused resources: Binary resource data reduced from 44KB to 35KB: Removed 20%
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':webview_flutter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\naonv\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT:
error: resource android:attr/fontVariationSettings not found.
C:\Users\naonv\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88: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 5m 12s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 315.2s (!)
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`... 178ms
√ `android\settings_aar.gradle` created successfully.
Building plugin webview_flutter...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 37.6s
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
WARNING: The option setting 'android.enableR8=true' is experimental and unsupported.
The current default is 'false'
Consider disabling R8 by removing 'android.enableR8=true' from your gradle.properties before publishing your app.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'webview_flutter'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 36s
The plugin webview_flutter could not be built due to the issue above.
this happend also with a flutter sample apps, maybe there's something wrong with my settings, but i don't know which i need to edit, did someone know how to solve this?
Solution 1: hosein moradi
- Open android folders project in android studio
- Set app builds varients on release
- In android studio menu -> generate signed bundle -> generate keystore apk