Android studio solves the problem of slow download of pytorch-android-1.6.0 version arr

In the fourth project of the github demo running the android migration pytorch project , I found that gradle downloads very slowly. According to the Internet, the domestic warehouse has been replaced:

maven {
    
     url 'https://maven.aliyun.com/repository/google' }
maven{
    
     url 'https://maven.aliyun.com/repository/jcenter'}

Still very slow. So I went to study some details of gradle: Since I was stuck on downloading pytorch-android.arr, the problem must lie nearby. As a result, I found that this part is said in gradle:

    implementation 'org.pytorch:pytorch_android:1.6.0-SNAPSHOT'
    implementation 'org.pytorch:pytorch_android_torchvision:1.6.0-SNAPSHOT'

Regarding the meaning of snapshot, it probably means that every time Maven builds, it checks the new snapshot version in the remote warehouse . Even if it is downloaded locally, he will look for it. Obviously, there may be such a situation. After all, the domestic warehouse is a foreign mirror. It will not be updated so fast, or even without a complete snapshot, which causes gradle to be searched and slow down. Speed.
Therefore, the solution is simple: change the code to:

    implementation 'org.pytorch:pytorch_android:1.6.0'
    implementation 'org.pytorch:pytorch_android_torchvision:1.6.0'

(The code is changed in build.gradle)
.
Do not use version 1.4.0 here, it will cause errors that cannot match other parts.

Guess you like

Origin blog.csdn.net/qq_44065334/article/details/113135490