作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
更新到 Dart 3.0 后,当我在 Android 模拟器上启动应用程序时出现此错误。
对于 iOS 物理设备,它的构建还可以。不幸的是,无法尝试使用 Android 物理设备。有任何想法吗?
e: /Users/amarchuk/.pub-cache/hosted/pub.dartlang.org/google_api_headers-1.2.0+1/android/src/main/kotlin/io/github/zeshuaro/google_api_headers/GoogleApiHeadersPlugin.kt: (52, 68): Type mismatch: inferred type is String? but String was expected
e: /Users/amarchuk/.pub-cache/hosted/pub.dartlang.org/google_api_headers-1.2.0+1/android/src/main/kotlin/io/github/zeshuaro/google_api_headers/GoogleApiHeadersPlugin.kt: (58, 68): Type mismatch: inferred type is String? but String was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':google_api_headers:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* 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.
2
* Get more help at https://help.gradle.org
BUILD FAILED in 33s
Exception: Gradle task assembleDebug failed with exit code 1
Exited
最佳答案
作为临时解决方案
flutter downgrade 2.10.5
try {
val info: PackageInfo
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
info = context!!.packageManager.getPackageInfo(call.arguments<String>(), PackageManager.GET_SIGNING_CERTIFICATES)
for (signature in info.signingInfo.apkContentsSigners) {
parseSignature(signature, result)
}
} else {
@Suppress("DEPRECATION")
info = context!!.packageManager.getPackageInfo(call.arguments<String>(), PackageManager.GET_SIGNATURES)
@Suppress("DEPRECATION")
for (signature in info.signatures) {
parseSignature(signature, result)
}
}
} catch (e: Exception) {
result.error("ERROR", e.toString(), null)
}
所以如果方法是空的并且什么都不做
if (call.method == "getSigningCertSha1") {}
我没有足够的知识来说明这样做的后果是什么,但我的应用程序正在运行,并且所有谷歌 API 也在运行(谷歌地图、谷歌登录、Firebase)
关于android - 任务 ':google_api_headers:compileDebugKotlin' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72221920/
更新到 Dart 3.0 后,当我在 Android 模拟器上启动应用程序时出现此错误。 对于 iOS 物理设备,它的构建还可以。不幸的是,无法尝试使用 Android 物理设备。有任何想法吗? e:
我是一名优秀的程序员,十分优秀!