我面临着从vs代码中扑出APK的问题。
我用来制作APK的命令。
flutter build apk --split-per-abi
我尝试了大多数解决方案,例如检查AndroidX兼容性,Flutter Clean,pub get,pub update等。 还是我在vs代码和android studio中都遇到了错误,
在此过程中,如果有人缺少我,请有人帮助我。
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.
答案 0 :(得分:0)
用于调试APK:
flutter build apk
要发布APK:
flutter build apk --release
对于App Bundle:
flutter build appbundle