uni-app 离线打包加入unipush,配置华为推送时卡死在import上
uni-app 离线打包加入unipush,配置华为推送时卡死在import上
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | win10 | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Windows
HBuilderX类型:正式
HBuilderX版本号:3.2.6
手机系统:Android
手机系统版本号:Android 11
手机厂商:华为
手机机型:华为
页面类型:vue
打包方式:离线
示例代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url ‘https://maven.google.com/’
name ‘Google’
}
// 配置HMS Core SDK的Maven仓地址。
maven {url ‘https://developer.huawei.com/repo/’}
}
dependencies {
classpath ‘com.android.tools.build:gradle:4.1.1’
// 增加agcp配置。
classpath ‘com.huawei.agconnect:agcp:1.4.1.300’
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects { repositories { google() jcenter() maven { url ‘https://maven.google.com/’ name ‘Google’ } // 配置HMS Core SDK的Maven仓地址。 maven {url ‘https://developer.huawei.com/repo/’} } }
task clean(type: Delete) { delete rootProject.buildDir }
操作步骤:
构建项目进行离线打包
预期结果:
构建成功,打包成功
实际结果:
一直在import 提示上面内容
bug描述:
Configure project :app –W- The variant: debug, Use the json file: C:\Users\84084\Desktop\rtsoms.sapp\app\agconnect-services.json –W- Please make sure agconnect-core SDK version is 1.4.1.300 or later –W- The variant: release, Use the json file: C:\Users\84084\Desktop\rtsoms.sapp\app\agconnect-services.json –W- Please make sure agconnect-core SDK version is 1.4.1.300 or later
一直在Importing Gradle project
更多关于uni-app 离线打包加入unipush,配置华为推送时卡死在import上的实战教程也可以访问 https://www.itying.com/category-93-b0.html
应该是仓库问题,
更多关于uni-app 离线打包加入unipush,配置华为推送时卡死在import上的实战教程也可以访问 https://www.itying.com/category-93-b0.html
吧谷歌仓库干掉了,谷歌里没有
此问题结束
问题出在华为推送(HMS Core)的依赖配置上。从日志看,虽然已配置agcp插件,但agconnect-core SDK版本可能不匹配或未正确引入。
检查以下配置:
- 主模块build.gradle中确保添加:
apply plugin: 'com.huawei.agconnect'
dependencies {
implementation 'com.huawei.hms:push:5.3.0.304'
}
- project/build.gradle的buildscript需包含:
buildscript {
dependencies {
classpath 'com.huawei.agconnect:agcp:1.6.0.300' // 建议升级到最新
}
}
- 同步gradle配置:
- 删除项目根目录的
.gradle文件夹 - 在Android Studio执行File > Sync Project with Gradle Files
- 或命令行执行
./gradlew clean build
- 网络问题处理: 如果卡在import,可能是Gradle下载依赖超时:
- 检查网络能否访问
developer.huawei.com/repo/ - 在gradle.properties添加代理配置:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080

