执行com.android.build.gradle.internal.res.Aapt2CompileRunnable时出错

jljoyd4f  于 2023-06-20  发布在  Android
关注(0)|答案(1)|浏览(234)

我尝试使用eas build -p android构建我的expo react本机应用程序,但它一直失败并给出此错误:
执行com.android.build.gradle.internal.res.Aapt2CompileRunnable时出错
我已经尝试了所有方法来解决它,但我无法,为什么Gradle总是引起这么多问题?
以下是完整的错误日志:

  1. [stderr]
  2. FAILURE: Build completed with 2 failures.
  3. [stderr]
  4. 1: Task failed with an exception.
  5. [stderr]
  6. -----------
  7. [stderr]
  8. * What went wrong:
  9. [stderr]
  10. Execution failed for task ':app:mergeReleaseResources'.
  11. [stderr]
  12. > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
  13. [stderr]
  14. > Android resource compilation failed
  15. [stderr]
  16. ERROR:/home/expo/workingdir/build/android/app/build/generated/res/react/release/drawable-mdpi/assets_userbg.png: AAPT: error: file failed to compile.
  17. [stderr]
  18. [stderr]
  19. * Try:
  20. [stderr]
  21. > Run with --stacktrace option to get the stack trace.
  22. [stderr]
  23. > Run with --info or --debug option to get more log output.
  24. [stderr]
  25. > Run with --scan to get full insights.
  26. [stderr]
  27. ==============================================================================
  28. [stderr]
  29. 2: Task failed with an exception.
  30. [stderr]
  31. -----------
  32. [stderr]
  33. * What went wrong:
  34. [stderr]
  35. java.lang.StackOverflowError (no error message)
  36. [stderr]
  37. * Try:
  38. [stderr]
  39. > Run with --stacktrace option to get the stack trace.
  40. [stderr]
  41. > Run with --info or --debug option to get more log output.
  42. [stderr]
  43. > Run with --scan to get full insights.
  44. [stderr]
  45. ==============================================================================
  46. [stderr]
  47. * Get more help at https://help.gradle.org
  48. [stderr]
  49. BUILD FAILED in 6m 41s
  50. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
  51. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
  52. See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
  53. Execution optimizations have been disabled for 3 invalid unit(s) of work during this build to ensure correctness.
  54. Please consult deprecation warnings for more details.
  55. 454 actionable tasks: 454 executed
  56. Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
xsuvu9jc

xsuvu9jc1#

我自己能弄明白。如果任何人有这个问题,这是一个资产问题,一些或一个资产文件将在错误的格式,例如,该文件将是.png,但在现实中,它不会是一个PNG文件,幸运的是,日志会告诉你哪个文件有这个问题,你可以将其转换为正确的格式,并继续前进。

相关问题