Reputation: 1932
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.
Upvotes: 12
Views: 58003
Reputation: 1447
For Debug APK :
flutter build apk
For Release APK :
flutter build apk --release
For App Bundle :
flutter build appbundle
Upvotes: 50