bundleRelease失败,并显示“任务:app:collectReleaseDependencies FAILED”

时间:2020-03-03 15:10:44

标签: android react-native bundle

当尝试捆绑我的Android React Native App的签名版本时(在Mac上)

./gradlew bundleRelease

消息失败

> Task :app:collectReleaseDependencies FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:collectReleaseDependencies'.
> java.lang.NullPointerException (no error message)

执行./gradlew bundleRelease --info时出现此错误:

> Task :app:collectReleaseDependencies FAILED
Task :app:collectReleaseDependencies in @react-native-community_async-storage Starting
file or directory '/Users/ingohinterding/github/codegreen/android/app/libs', not found
Caching disabled for task ':app:collectReleaseDependencies' because:
  Build cache is disabled
Task ':app:collectReleaseDependencies' is not up-to-date because:
  Task has failed previously.
file or directory '/Users/ingohinterding/github/codegreen/android/app/libs', not found
Task :app:collectReleaseDependencies in @react-native-community_async-storage Finished
:app:collectReleaseDependencies (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.396 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:collectReleaseDependencies'.
> java.lang.NullPointerException (no error message)

我添加了该文件夹android/app/libs,当我再次运行./gradlew bundleRelease --info时,这是新错误:

> Task :app:collectReleaseDependencies FAILED
Task :app:collectReleaseDependencies in @react-native-community_async-storage Starting
Caching disabled for task ':app:collectReleaseDependencies' because:
  Build cache is disabled
Task ':app:collectReleaseDependencies' is not up-to-date because:
  Task has failed previously.
Task :app:collectReleaseDependencies in @react-native-community_async-storage Finished
:app:collectReleaseDependencies (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 0.339 secs.

FAILURE: Build failed with an exception.

注意:尝试./gradlew assembleRelease时,构建成功,但由于未优化APK而被Google Play商店拒绝。

由于我是RN的初学者,所以我不确定要查找的内容以及此处需要哪些信息。 React Native版本为0.59.9(如果我进行更新,可能会导致很多内容中断,因此,我将尝试将其保留为该版本)。

1 个答案:

答案 0 :(得分:0)

我成功完成了以下操作:

  1. 将Android Studio更新到最新版本
  2. 将Gradle更新到最新版本
  3. 使用./gradlew bundleRelease --build-cache构建

希望这可以帮助其他遇到相同问题的人。