Flutter:构建错误:任务“:app:processDebugResources”执行失败

SDS*_*712 0 build-error dart flutter flutter-dependencies androidx

在将 flutter 升级到 v1.17.3 之前,一切正常,

已经尝试过:

flutter clean
Run Code Online (Sandbox Code Playgroud)

flutter downgrade
Run Code Online (Sandbox Code Playgroud)

我得到的错误(构建失败):

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.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\Shamuvel\Desktop\App Development\PROJECTS\Grocery Store\groci\android\Store\groci\android\app\src\main\AndroidManifest.xml:8:5-47:19: AAPT: error: attribute android:requestLegacyExternalStorage 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 1m 27s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin path_provider...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'path_provider'.
> 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 5s

Exception: The plugin path_provider could not be built due to the issue above.
Run Code Online (Sandbox Code Playgroud)

gradle.properties 文件:

org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
Run Code Online (Sandbox Code Playgroud)

解决方案赞赏

谢谢!

SDS*_*712 8

最后,在文件中将compileSdkVersion&targetSdkVersion从 28切换到 29android/app/build.gradle有效。

也检查这些解决方案,可能会对您有所帮助:-

AAPT:错误:未找到属性 android:requestLegacyExternalStorage

Flutter:调试构建成功但发布出错