在我的 flutter 应用程序中,我无法进行构建。构建失败。
我已经执行了以下命令来在我的 Android 手机中进行构建:
flutter build apk --release
通过执行上述命令,我收到以下错误:
Font asset "BoxIcons.ttf" was tree-shaken, reducing it from 320764 to 888 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when bu ilding your app. Font asset "Iconsax.ttf" was tree-shaken, reducing it from 992800 to 2992 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when bu ilding your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 3440 bytes (99.8% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-ico ns flag when building your app.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':read_pdf_text:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR: /home/ruban/YAVAR/CLONE/prive_app/build/read_pdf_text/intermediates/merged_res/release/mergeReleaseResources/values/values.xml:194: AAPT: error: resource android:attr/ lStar 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 8s
Running Gradle task 'assembleRelease'...
Gradle task assembleRelease failed with exit code 1
9.35
我正在使用 flutter 版本:
Flutter 3.24.3
帮我解决这个问题。
发生这种情况是因为您正在使用的
read_pdf_text包中的
compileSdkVersion
已过时。
解决此问题的最快决定是在您的
subprojects
中添加另一个 build.gradle
块(根块,而不是 app/build.gradle
)并向上 compileSdkVersion
到处:
subprojects {
afterEvaluate {
// Version must be 31 or newer, 34 here is just example because it is used by Flutter itself.
compileSdkVersion 34
}
}
最好的决定是切换到更现代的软件包,其依赖项是最新的。