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

提交Google Play Console时EAS Build遇Segment SDK合规错误

解决Google Play提示Segment SDK违规问题

1. 定位隐藏的Segment依赖来源

你没有直接引入Segment SDK,但它可能是第三方依赖的安卓侧间接依赖。按以下步骤找出根源:

  • 生成本地安卓构建文件:执行eas build --platform android --local,构建完成后项目根目录会生成android文件夹。
  • 查看完整Gradle依赖树:进入android目录,运行:
    ./gradlew app:dependencies
    
    在输出中搜索com.segment.analytics.android:analytics,找到它的父依赖(格式通常为xxx:yyy -> com.segment...)。
  • (可选)APK验证:用Android Studio的APK Analyzer加载构建好的APK,搜索com.segment相关类,确认依赖来源。

2. 排除Segment依赖

找到引入Segment的父依赖后,通过Gradle配置移除它:

  • Expo项目可修改app.json/app.config.js,添加自定义Config Plugin修改Gradle配置:
    {
      "expo": {
        "android": {
          "configPlugins": [
            [
              "@expo/config-plugins",
              "withAndroidGradle",
              {
                "dependencies": {
                  "exclude": [
                    {
                      "group": "com.segment.analytics.android",
                      "module": "analytics"
                    }
                  ]
                }
              }
            ]
          ]
        }
      }
    }
    
  • 也可直接修改android/app/build.gradle,在对应依赖项中添加exclude规则:
    dependencies {
      // 示例:假设是react-native-push-notification引入的Segment
      implementation(project(':react-native-push-notification')) {
        exclude group: 'com.segment.analytics.android', module: 'analytics'
      }
    }
    

3. 验证并重新构建

  • 执行eas build -p android重新构建APK。
  • 用APK Analyzer确认com.segment相关类已被移除。
  • 再次提交至Google Play Console检查。

额外排查点

  • 若不需要Segment分析功能,直接卸载expo-analytics-segment(执行expo uninstall expo-analytics-segment),避免不必要的依赖。
  • 检查第三方依赖更新日志:比如react-native-push-notification、react-native-elements等包,是否在旧版本默认引入了Segment,尝试升级到最新稳定版。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 00:22:33