美文网首页Flutter学习
Could not get resource 'https://

Could not get resource 'https://

作者: 三也视界 | 来源:发表于2021-07-05 00:53 被阅读0次
Launching lib\main.dart on MHA AL00 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.github.Polidea:MultiPlatformBleAdapter:0.1.8.
     Required by:
         project :app > project :flutter_ble_lib
      > Could not resolve com.github.Polidea:MultiPlatformBleAdapter:0.1.8.
         > Could not get resource 'https://jcenter.bintray.com/com/github/Polidea/MultiPlatformBleAdapter/0.1.8/MultiPlatformBleAdapter-0.1.8.pom'.
            > Could not HEAD 'https://jcenter.bintray.com/com/github/Polidea/MultiPlatformBleAdapter/0.1.8/MultiPlatformBleAdapter-0.1.8.pom'.
               > Read timed out

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 36s
Exception: Gradle task assembleDebug failed with exit code 1

我们可以看到 Read timed out,可能是网络的问题,之前还好好的,因为将flutter升级到2.0之后就出现了,第一反应是不是版本问题,可是奇怪的是无论怎么修改都报这个错误。

之后就是一顿折腾代理的问题,发现还是不能解决。其实上面报错很清晰,就是jcenter的问题。

我们可以打开https://status.bintray.com/

image.png

为什么没有更新之前没这个问题?因为你的包已经下载到本地,不会再去jcenter拉取,升级之后upgrade自然要去拉取,然后报错了。

我们知道jcenter只是一个托管中心罢了,我们要怎么解决问题,毕竟工作还得继续。

image.png

在External Libraries --》 Flutter Plugins随便找一个包右键show in Explorer,mac环境有点区别,这里不展开。

image.png

我们可以看到打开了一个文件夹


image.png

继续解决我们的问题,报错的是flutter_ble_lib: ^2.3.0引入的

image.png
进入.cache文件夹,可以发现 包名-versions.json的文件,
image.png
http://www.bejson.com/格式化后如下(中间删掉了一些版本,其实versions只留需要的版本就可以了,列出来的是因为有一些其他依赖需要不同版本的时候会去拉取)
{
    "name": "flutter_ble_lib",
    "latest": {
        "version": "2.3.2",
        "pubspec": {
            "name": "flutter_ble_lib",
            "description": "FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..",
            "version": "2.3.2",
            "homepage": "https://github.com/Polidea/FlutterBleLib",
            "environment": {
                "sdk": ">=2.1.0 <3.0.0",
                "flutter": ">=1.10.0 <2.0.0"
            },
            "dependencies": {
                "collection": "^1.14.11",
                "async": "^2.2.0",
                "flutter": {
                    "sdk": "flutter"
                }
            },
            "dev_dependencies": {
                "test": "^1.5.3",
                "mockito": "^4.0.0",
                "pedantic": "^1.9.0",
                "flutter_test": {
                    "sdk": "flutter"
                }
            },
            "flutter": {
                "plugin": {
                    "platforms": {
                        "android": {
                            "package": "com.polidea.flutter_ble_lib",
                            "pluginClass": "FlutterBleLibPlugin"
                        },
                        "ios": {
                            "pluginClass": "FlutterBleLibPlugin"
                        }
                    }
                }
            }
        },
        "archive_url": "https://pub.flutter-io.cn/packages/flutter_ble_lib/versions/2.3.2.tar.gz",
        "published": "2021-02-03T18:23:22.088342Z"
    },
    "versions": [{
        "version": "1.0.0",
        "pubspec": {
            "version": "1.0.0",
            "dependencies": {
                "protobuf": "^0.6.0",
                "convert": "^2.0.1",
                "flutter": {
                    "sdk": "flutter"
                }
            },
            "name": "flutter_ble_lib",
            "author": "Polidea",
            "flutter": {
                "plugin": {
                    "androidPackage": "com.polidea.flutterblelib",
                    "pluginClass": "FlutterBleLibPlugin"
                }
            },
            "description": "FlutterBle Library is a flutter library that supports ble connections. It uses RxAndroidBle and RxBluetoothKit as native libs.",
            "homepage": "https://github.com/Polidea/FlutterBleLib",
            "environment": {
                "sdk": ">=1.8.0 <2.0.0"
            }
        },
        "archive_url": "https://pub.flutter-io.cn/packages/flutter_ble_lib/versions/1.0.0.tar.gz",
        "published": "2018-03-02T10:29:01.312778Z"
    }, {
        "version": "2.3.2",
        "pubspec": {
            "name": "flutter_ble_lib",
            "description": "FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..",
            "version": "2.3.2",
            "homepage": "https://github.com/Polidea/FlutterBleLib",
            "environment": {
                "sdk": ">=2.1.0 <3.0.0",
                "flutter": ">=1.10.0 <2.0.0"
            },
            "dependencies": {
                "collection": "^1.14.11",
                "async": "^2.2.0",
                "flutter": {
                    "sdk": "flutter"
                }
            },
            "dev_dependencies": {
                "test": "^1.5.3",
                "mockito": "^4.0.0",
                "pedantic": "^1.9.0",
                "flutter_test": {
                    "sdk": "flutter"
                }
            },
            "flutter": {
                "plugin": {
                    "platforms": {
                        "android": {
                            "package": "com.polidea.flutter_ble_lib",
                            "pluginClass": "FlutterBleLibPlugin"
                        },
                        "ios": {
                            "pluginClass": "FlutterBleLibPlugin"
                        }
                    }
                }
            }
        },
        "archive_url": "https://pub.flutter-io.cn/packages/flutter_ble_lib/versions/2.3.2.tar.gz",
        "published": "2021-02-03T18:23:22.088342Z"
    }, {
        "version": "3.0.0-beta",
        "pubspec": {
            "name": "flutter_ble_lib",
            "description": "FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..",
            "version": "3.0.0-beta",
            "homepage": "https://github.com/Polidea/FlutterBleLib",
            "environment": {
                "sdk": ">=2.1.0 <3.0.0",
                "flutter": ">=1.10.0 <2.0.0"
            },
            "dependencies": {
                "collection": "^1.14.11",
                "async": "^2.2.0",
                "flutter": {
                    "sdk": "flutter"
                }
            },
            "dev_dependencies": {
                "test": "^1.5.3",
                "mockito": "^4.0.0",
                "pedantic": "^1.9.0",
                "flutter_test": {
                    "sdk": "flutter"
                }
            },
            "flutter": {
                "plugin": {
                    "platforms": {
                        "android": {
                            "package": "com.polidea.flutter_ble_lib",
                            "pluginClass": "FlutterBleLibPlugin"
                        },
                        "ios": {
                            "pluginClass": "FlutterBleLibPlugin"
                        }
                    }
                }
            }
        },
        "archive_url": "https://pub.flutter-io.cn/packages/flutter_ble_lib/versions/3.0.0-beta.tar.gz",
        "published": "2020-12-11T16:50:26.780270Z"
    }],
    "_fetchedAt": "2021-03-16T11:23:47.729505"
}

查看该插件所引入的Android包,打开build.gradle

image.png

找到了罪魁祸首MultiPlatformBleAdapter包


image.png

那么我们只要手动下载之后放到对应的位置即可(不同人的gradle存放的位置不一样)。之前我是下载过1.0.6版本的,打开.gradle\caches\modules-2\files-2.1\com.github.Polidea\MultiPlatformBleAdapter
0.1.6里面是有aar包的,而0.1.8还没有下载好所以里面只有一个pom文件(pom其实就是aar或者jar依赖的其他第三方工程的一个配置文件),这个也是我们报错的地方。


image.png

从github我们找到了
https://github.com/Polidea/MultiPlatformBleAdapter/releases对应的1.0.8版本,点击下载

image.png image.png

打开.gradle\caches\modules-2\files-2.1,将刚刚下载的包解压出来的是源码,我们需要的是aar文件

Androidstudio打开源码,编译aar


image.png image.png image.png image.png

相关文章

网友评论

    本文标题:Could not get resource 'https://

    本文链接:https://www.haomeiwen.com/subject/uwxdcltx.html