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

RN0.72.7构建Android应用时@shopify/react-native-skia遇Gradle方法签名错误

解决@shopify/react-native-skia与React Native 0.72.7的Android构建错误

问题原因

该错误源于Gradle/Android Gradle Plugin(AGP)版本不兼容,或是当前安装的react-native-skia版本与RN 0.72.7默认使用的AGP 7.3.1适配性不足,具体表现为skia的build.gradle中获取AGP版本的语法在当前构建环境下无法被识别。

解决方案

1. 安装适配RN 0.72.7的react-native-skia版本

RN 0.72.7默认适配AGP 7.3.1,推荐安装0.1.192及以上版本的react-native-skia:

npm uninstall @shopify/react-native-skia
npm install @shopify/react-native-skia@0.1.192

2. 确认项目Gradle与AGP版本匹配

检查项目根目录的android/build.gradle,确保AGP版本为7.3.1:

buildscript {
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        // 其他依赖保持原有配置即可
    }
}

同时检查android/gradle/wrapper/gradle-wrapper.properties中的Gradle版本为7.5:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

3. 临时修复skia的build.gradle(版本适配后仍报错时)

若安装适配版本后问题依旧,可临时修改node_modules/@shopify/react-native-skia/android/build.gradle中获取AGP版本的代码:
将原代码:

def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION

替换为以下二者之一:

def agpVersion = com.android.build.gradle.internal.version.Version.ANDROID_GRADLE_PLUGIN_VERSION

或

def agpVersion = project.androidPluginVersion

4. 清理构建缓存

执行以下命令清理缓存并重新安装依赖:

cd android && ./gradlew clean
cd .. && rm -rf node_modules package-lock.json
npm install

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 23:17:10