You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo Android Play Store构建失败,Gradle配置报错求助

Android Play Store构建失败解决思路

核心错误日志

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/home/expo/workingdir/build/node_modules/expo-application/android/build.gradle' line: 40
* What went wrong:
A problem occurred evaluating project ':expo-application'.
> Could not set unknown property 'classifier' for task ':expo-application:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

==============================================================================
2: Task failed with an exception.
-----------
* Where:
Script '/home/expo/workingdir/build/node_modules/expo-modules-core/android/ExpoModulesCorePlugin.gradle' line: 65
* What went wrong:
A problem occurred configuring project ':expo'.
> Could not get unknown property 'release' for SoftwareComponent container of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.

解决思路

1. 修复expo-application的classifier属性错误

  • 问题根源:Gradle 7.0+ 废弃了Jar任务的classifier属性,改用archiveClassifier,旧版expo-application未适配该变更。
  • 解决方案:
    • 优先方案:升级expo-application到最新兼容版本,新版本已修复该API适配问题。
    • 临时修复:直接修改node_modules/expo-application/android/build.gradle第40行,将classifier = 'sources'替换为archiveClassifier = 'sources'。

2. 修复expo-modules-core的release组件获取错误

  • 问题根源:Gradle 7.0+ 调整了SoftwareComponent容器的结构,旧版expo-modules-core的组件获取逻辑失效。
  • 解决方案:
    • 优先方案:升级expo-modules-core到最新稳定版本,官方已修复该适配问题。
    • 检查项目Gradle版本与expo依赖的兼容性:若使用Gradle 7.0+,确保所有expo插件版本均为适配该Gradle版本的版本;若暂时无法升级插件,可尝试降低Gradle版本到6.x系列。

3. 通用排查步骤

  • 执行./gradlew clean清除构建缓存后重新尝试构建。
  • 确保package.json中所有expo相关依赖版本统一,且与项目使用的Expo SDK版本匹配。
  • 若为Expo managed项目,运行expo upgrade同步所有依赖至兼容版本。

内容的提问来源于stack exchange,提问作者Grim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 09:00:03