更新flutter或android studio后,我面临一个奇怪的问题。我以前能够运行flutter build apk命令。但是我可以将ipa导出到同一应用程序的iOS版本。
我已经更新了软件包的最新版本。检查“ compilesdkversion 28”。我认为一切看起来都很好。
您可以在下面看到我失败的包裹。
这是错误输出;
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':keyboard_visibility:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/serkanerkan/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/serkanerkan/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/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 16s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 17.8s
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 connectivity...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1,391ms
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'connectivity'.
> 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 1s
The plugin connectivity could not be built due to the issue above.
答案 0 :(得分:3)
转到此文件夹-> C:\flutter.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android 打开 构建.gradle 将 compileSdkVersion 27 更改为 compileSdkVersion 28 然后flutter clean -> flutter pub get -> flutter build apk --release
答案 1 :(得分:1)
我通过在 Android Studio 中更改它解决了这个问题。
内部项目视图,
"[project_folder]/external_package/flutter_plugin/[problem_causing_plugin_name]/android/build.gradle/"
将 compileSdkVersion 27
改为 compileSdkVersion 28
然后,运行 Flutter clean
和 Flutter pub get
,然后
再次尝试创建发布 apk。
答案 2 :(得分:0)
这里也有同样的问题。通过将位于 keyboard_visibility 插件的 build.gradle 文件中的 compileSdkVersion 更改为与项目的 compileSdkVersion 相同来修复。
下面的链接是我参考的参考,它有助于解决我的问题。
https://www.freesion.com/article/1672819994/