React Native Android打包报错::app:signReleaseBundle执行失败
解决React Native Android构建
Task :app:signReleaseBundle FAILED问题 问题核心
表面报错显示多个Kotlin守护进程会话并抛出java.lang.NullPointerException,但实际根源是notifee_react-native引入的app.notifee:core:+依赖无法解析——动态版本号+导致Gradle找不到对应可用版本。
解决方案
1. 锁定app.notifee:core具体版本
先查看package.json里notifee_react-native的版本,匹配对应的app.notifee:core版本(比如notifee-react-native@7.8.0对应app.notifee:core:7.8.0),在android/app/build.gradle中强制指定:
dependencies { // 替换为与你的notifee版本匹配的core版本号 implementation('app.notifee:core:7.8.0') { force = true } }
2. 排除原动态依赖后手动添加指定版本
如果强制版本无效,直接排除notifee_react-native自带的动态依赖,再手动引入固定版本:
dependencies { implementation(project(':notifee_react-native')) { exclude group: 'app.notifee', module: 'core' } implementation 'app.notifee:core:7.8.0' // 替换为对应版本 }
3. 检查仓库配置
确保android/build.gradle的repositories块包含mavenCentral,app.notifee依赖托管在此仓库:
allprojects { repositories { mavenCentral() // 其他仓库配置... } }
4. 彻底清理Gradle缓存
执行以下命令清理缓存,避免旧缓存干扰依赖解析:
./gradlew clean ./gradlew cleanBuildCache rm -rf ~/.gradle/caches
5. 升级Kotlin版本(可选)
当前使用的Kotlin 1.6.0可能与notifee新版本不兼容,尝试升级到1.7.20或更高(注意与Gradle插件版本匹配),修改android/build.gradle:
buildscript { ext { kotlinVersion = "1.7.20" // 其他原有配置... } }
验证
执行./gradlew :app:bundleRelease --info确认依赖解析错误已解决,再重新执行签名打包流程。
内容的提问来源于stack exchange,提问作者Gh05d
相关产品推荐
相关产品推荐

