我正在维护一个 brownfield react-native 应用程序,并将 react-native 版本从 0.59.9 迁移到 0.63.4。我完成了更改日志和升级助手中定义的步骤,并且可以在模拟器上运行该应用程序,但是当我尝试构建它时,我在 bundleDebugAar
步骤中遇到此错误:
> Direct local .aar file dependencies are not supported when building an
AAR. The resulting AAR would be broken because the classes and Android
resources from any local .aar file dependencies would not be packaged in
the resulting AAR. Previous versions of the Android Gradle Plugin produce
broken AARs in this case too (despite not throwing this error). The
following direct local .aar file dependencies of the :myapp-react-
integration project caused this error: /Users/.../node_modules/hermes-
engine/android/hermes-release.aar
渐变版本:
const val BUILD_TOOLS_VERSION = "30.0.1"
const val GRADLE_VERSION = "4.0.1"
这是我的 build.gradle.kts:
plugins {
id(BuildPlugins.androidLibrary)
id(BuildPlugins.kotlinAndroid)
id(BuildPlugins.kotlinAndroidExtensions)
id(BuildPlugins.kotlinKapt)
id(BuildPlugins.junit)
}
android{
androidExtensions {
isExperimental = true
}
}
val react by extra {
mapOf(
"enableHermes" to true
)
}
dependencies {
// Dependencies for local unit tests
// JUnit and Mockito
junit5()
mockito()
testImplementation(TestLibraries.JUNIT4)
api(Libraries.REACT_NATIVE)
implementation("com.facebook.soloader:soloader:0.9.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation(Libraries.Tracking.SNOWPLOW)
implementation(project(Libraries.Tracking.BRAZE_REACT_NATIVE))
rx()
dagger()
firebase()
implementation(Libraries.gson)
implementation(Libraries.Timber)
implementation(Libraries.AndroidX.PREFERENCE)
implementation(TestLibraries.Espresso.IDLING)
androidTestRuntimeOnly(TestLibraries.Junit5.RUNNER)
/********************************************/
/* REACT */
/** ******************************************/
val hermesPath = "$rootDir/node_modules/hermes-engine/android/"
debugImplementation(files(hermesPath + "hermes-debug.aar"))
releaseImplementation(files(hermesPath + "hermes-release.aar"))
}
如果有人能提供帮助,我会很高兴。
谢谢。
最佳答案
Hermes 在最近版本的 react-native 中移动,而不是:
val hermesPath = "$rootDir/node_modules/hermes-engine/android/"
debugImplementation(files(hermesPath + "hermes-debug.aar"))
releaseImplementation(files(hermesPath + "hermes-release.aar"))
做
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
关于由于 hermes-debug.aar 引用,gradle bundleDebugAar 步骤失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66168353/