尝试构建发布时直接本地 .aar 文件依赖项错误

问题描述 投票:0回答:0

希望你星期六过得愉快。 我正在尝试使用这个库构建一个项目:https://github.com/kickbk/react-native-star-io10-expo-47 它是 https://github.com/star-micronics/react-native-star-io10 的一个分支 我正在为 Android 构建。 当我构建开发客户端时,它是

Running 'gradlew :app:assembleDebug'
并且可以正常工作。 当我现场构建时,它是
Running 'gradlew :app:assembleRelease'
并且失败了。 这里有 PR 应该修复它:https://github.com/star-micronics/react-native-star-io10/pull/56/commits/f17101dc4d66eec78adece032ae48e6bf2211c19 所以在我的叉子里,我有

dependencies {
    // noinspection GradleDynamicVersion
    api 'com.facebook.react:react-native:+'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compileOnly files('src/lib/stario10.aar')
    implementation files('../../react-native-star-io10/android/src/lib/stario10.aar')
    ...
}

他们在公关中写道:

Add the snippet below to the `dependencies` block in android/app/build.gradle:
implementation files('../../node_modules/react-native-star-io10/android/src/lib/stario10.aar')

如果你看看我的叉子,你会发现我做到了。 我相信他们用

../../node_modules
写错了,因为我们已经在里面了
node_modules
...meh

所以我创建了 fork 并运行了构建,但它失败了

Execution failed for task ':react-native-star-io10:bundleReleaseLocalLintAar'.
> Error while evaluating property 'hasLocalAarDeps' of task ':react-native-star-io10:bundleReleaseLocalLintAar'
   > 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 :react-native-star-io10 project caused this error: /home/expo/workingdir/build/node_modules/react-native-star-io10/android/src/lib/stario10.aar

我看到了这个相关的讨论:Error building Android library: Direct local .aar file dependencies are not supported我相信解决这个问题应该很简单,但我对Android开发不是很熟悉。希望在这里提供简单的说明以帮助您完成这项工作。

android react-native android-gradle-plugin aar
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.