代码
https://github.com/nihui/ncnn-android-yolov5
腾讯nihui大神:倪辉,女,90年生
nihui,腾讯优图实验室高级研究员,从事视觉AI算法的研究工作。主导研发和维护业界首个端侧高性能AI推理框架ncnn,以开源的力量帮助AI落地和促进产业发展。
教程视频
注意:
1、在目录ncnn-android-yolov5-master\app\src\main\jni放入ncnn文件,并修改CMakeLists.txt文件里的路径
2、在文件gradle-wrapper.properties里修改gradle版本
distributionUrl=http\://artifactory.cde.huawei.com/artifactory/gradle-distributions/gradle-6.7.1-all.zip
https://xugaoxiang.com/2021/02/02/android-ncnn-yolov5/
问题:
No variants found for ':app'. Check build files to ensure at least one variant exists
解决方法:
Android SDK版本不对
在模块build.gradle文件里的compileSdkVersion设置为28
https://blog.youkuaiyun.com/weixin_43342290/article/details/115212058
问题:
An old version of CMake is being used that cannot automatically detect
或
No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
解决方法:
修改工程build.gradle文件里的classpath的gradle的版本为4.2.1
https://blog.si-yee.com/2019/07/12/%E8%A7%A3%E5%86%B3Android-Studio%E2%80%94%E2%80%94No-toolchains-found-in-the-NDK-toolchains-folder-for-ABI-with-prefix-mips64el-linux-android%E9%94%99%E8%AF%AF/
问题:
EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@4012292d
解决方法:
过一会自动好了?!
==================================================================================================================================
问题:
CMake ‘3.6.0’ was not found in PATH or by cmake.dir property. - CMake ‘3.10.2’ found in SDK did not match requested version ‘3.6.0’
解决方法:
app的build.gradle文件里
android{
externalNativeBuild {
cmake {
version "3.22.1"
}
}
}
https://blog.youkuaiyun.com/miao_007/article/details/87632758
https://www.jianshu.com/p/f2a1365fca80
问题:
com.intellij.openapi.externalSystem.model.ExternalSystemException
暂无解决
https://github.com/nihui/ncnn-android-yolov5/issues/21
https://github.com/HUGHNew/Site/blob/master/blogs/Android-Yolo5.md
==================================================================================================================================
Could not find method android() for arguments [build_25zy1japkfafsu0dvxbfxezl5$_run_closure2@4d636d1d] on root project
是因为app的build.gradle文件的顶部缺少这句话
apply plugin: 'com.android.application'
https://blog.youkuaiyun.com/qq_35008279/article/details/80741085
Cause: compileSdkVersion is not specified
https://www.codeleading.com/article/12423883144/
===================================================
问题:
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled
解决方法:
打开下图选中的文件gradle.properties,添加下面两句话
android.useAndroidX=true
android.enableJetifier=true
https://blog.youkuaiyun.com/weixin_44135826/article/details/105981267
问题:
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module
解决方法:
java jdk版本太高了 从16降到8
https://forum.cocos.org/t/topic/120533
问题:
lease remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories
解决方法:
//jcenter()
mavenCentral()
https://stackoverflow.com/questions/67418153/android-studio-gradle-please-remove-usages-of-jcenter-maven-repository-from
=========================================================================================
手动下载Gradle,放在目录"C:/Users/[你的名称]/.gradle/wrapper/dists/[一串英文]"下
https://www.jianshu.com/p/4c0415a79214
问题:
org.codehaus.groovy.control.MultipleCompilationErrorsException
解决方法:
将 “File – Project Structure – Project ”路径下的Gradle version改为最新版本
https://blog.youkuaiyun.com/weixin_42433094/article/details/115937572
问题:
Connect to dl.google.com:443 [dl.google.com/180.163.151.33] failed: Connection timed out: connect
Using insecure protocols with repositories, without explicit opt-in, is unsupported
解决方法:
在工程build.gradle的repositories里面添加
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/repository/google'
}
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/repository/jcenter'
}
maven {
allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public'
}
https://www.v2ex.com/t/724894
https://blog.youkuaiyun.com/qi_ming_hao_nan/article/details/114799678