前言:
本文章只针对能较为熟练使用Android Studio进行安卓开发的朋友,如果你对安卓开发并不熟练,可以先熟练了再来尝试。
首先,感谢PIPIKAI(钟志凯)的开源分享,我们将在他的项目android-ncnn-yolo11的基础上进行安卓部署。
PIPIKAI
https://github.com/PIPIKAI效果预览:
一、获取源码
建议3种方式来获取源码
1、git clone:
git clone https://github.com/PIPIKAI/android-ncnn-yolo11.git
2、进入GitHub下载ZIP文件:
3、我的网盘分享:
通过百度网盘分享的文件:android-ncnn-yolo11-main.zip 提取码:8888https://pan.baidu.com/s/1uIoXxLxQfWV3H78RSxQxWg
二、快速下载依赖:
2.1 使用的gradle版本是8.7,可以根据自己的需要降低版本
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
2.2 在修改gradle版本时注意对应的配置
2.3 修改settings.gradle
pluginManagement {
repositories {
google() // 优先使用 Google 官方仓库,确保 Firebase 依赖解析
mavenCentral() // Maven 中央仓库,确保可以找到最新的公共依赖
maven { url 'https://maven.aliyun.com/repository/google' } // 阿里云镜像
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } // 阿里云镜像
maven { url 'https://jitpack.io' } // JitPack 仓库
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// 配置 Google 的国内镜像
maven {
url 'https://maven.aliyun.com/repository/google'
}
// 配置 MavenCentral 的国内镜像
maven {
url 'https://maven.aliyun.com/repository/central'
}
// 添加 JCenter 备用镜像(如需要)
maven {
url 'https://maven.aliyun.com/repository/jcenter'
}
// 如果需要依赖 Kotlin 相关库,可添加以下镜像
maven {
url 'https://maven.aliyun.com/repository/public'
}
}
}
rootProject.name = "android-ncnn-yolo11"
include ':app'
}
2.4