uni-app 原生插件打包提示无法加载

uni-app 原生插件打包提示无法加载

操作步骤:

` 。。。


## 预期结果:
`
。。。

实际结果:

` 。。。


## bug描述:

原生插件打包配置依赖信息

```json
"dependencies": [  
    "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-java:v8.1.5-jitpack",  
    "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:v8.1.5-jitpack",  
    "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-ex_so:v8.1.5-jitpack",  
    "com.zhy:autolayout:1.4.5",  
    "com.facebook.fresco:fresco:1.13.0"  
]
```

提交打包系统报错  
提示  
```
FAILURE: Build failed with an exception.  
```

- What went wrong:
```
Execution failed for task ':app:checkReleaseAarMetadata'.  
```
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
> Could not download gsyVideoPlayer-ex_so-v8.1.5-jitpack.aar (com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-ex_so:v8.1.5-jitpack)
> Could not get resource 'https://jitpack.io/com/github/CarGuo/GSYVideoPlayer/gsyVideoPlayer-ex_so/v8.1.5-jitpack/gsyVideoPlayer-ex_so-v8.1.5-jitpack.aar'.
> Read timed out  
- Try:
```
Run with --debug option to get more log output. Run with --scan to get full insights.  
```
- Exception is:
```
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:checkReleaseAarMetadata'.  
```

该链接地址  
https://jitpack.io/com/github/CarGuo/GSYVideoPlayer/gsyVideoPlayer-ex_so/v8.1.5-jitpack/gsyVideoPlayer-ex_so-v8.1.5-jitpack.aar  
是能访问也能获取的
```

更多关于uni-app 原生插件打包提示无法加载的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

请问下有解决了吗?

更多关于uni-app 原生插件打包提示无法加载的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这个错误是典型的依赖下载超时问题。虽然你手动访问链接能成功,但Gradle构建时网络连接不稳定导致超时。

主要原因:

  1. 网络环境问题(特别是国内访问jitpack.io不稳定)
  2. Gradle下载超时时间设置过短
  3. 依赖包较大下载时间过长

解决方案:

方案一:增加Gradle超时时间 在项目根目录的 gradle.properties 文件中添加:

org.gradle.internal.http.socketTimeout=60000
org.gradle.internal.http.connectionTimeout=60000

方案二:使用国内镜像源 在项目根目录的 build.gradle 中添加jitpack镜像:

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/jitpack' }
        maven { url 'https://jitpack.io' }
    }
}

方案三:清理Gradle缓存后重试

# 清理缓存
./gradlew cleanBuildCache

# 重新构建
./gradlew build
回到顶部