Skip to content

UBI Android SDK 常见问题

1. 打包过程中出现 Could not find UbmLib-x.y.z.jar错误,导致打包失败

UBI Android SDK 的文件格式为 aar,打包过程中错误的请求 jar 格式的库。UBI Android SDK 会首先发布到 maven central,其他的仓库如果没有及时从 maven central 同步最新的版本,则会拉取依赖失败,然后尝试拉取 jar 格式的库,出现了这个问题。这个时候需要清除 gradle 的缓存,在终端中执行以下命令解决问题:

1
2
3
# Mac OS
rm -rf ~/.gradle/caches
rm -rf .gradle

2. 打包过程中出现 Backend Internal error: Exception during IR lowering 错误

具体错误信息如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
org. jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: 
**/**/FlutterUbiPlugin.kt
The root cause java. lang. AssertionError was thrown at: org.jetbrains.kotlin.ir.util.TypeTranslator.toIrTypeAbbreviation(TypeTranslator.kt:167
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
at org. jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:235)
at org. jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:124)
at org. jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:112)
at org. jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
at org. jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:30)
at org. jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
at org. jetbrains.kotlin.backend.common.phaser.CompilerPhasekt.invokeToplevel(CompilerPhase.kt:41)
at org. jetbrains.kotlin.backend.jvm.JvmLower.lower(JvmLower.kt:406)

该错误是由于 Kotlin的一个bug 导致的,在 kotlin 1.5.0-RC 及其以下,在module之间使用经过 typealias 修饰的类型时,会出现以上错误。该问题在Kotlin 1.5.20 正式版已经修复了,升级至1.5.20+即可解决问题。