flutter 使用Mob的ShareSdk踩的坑

是通过直接联系Mob的工作人员才得以解决的

报错信息如下:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.mob:MobToolsMCFP:+.
     Required by:
         project :app
         project :app > project :sharesdk
      > Failed to list versions for com.mob:MobToolsMCFP.
         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/mob/MobToolsMCFP/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/mob/MobToolsMCFP/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/mob/MobToolsMCFP/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

原因,貌似和image_picker这个插件冲突了。

打开External Libraries--Flutter Plugins--image_picker--android--build.gradle,找到如下代码,注释掉Maven的三行代码,这个错误就解决掉了。期间android studio可能会提示

 

 

选择第一个,点击ok就好了。

rootProject.allprojects {
    repositories {
        google()
        jcenter()
       /* maven {
            url 'https://google.bintray.com/exoplayer/'
        } */
    }
}

 

ps:遇到无法解决的错误,可以到项目Android/app目录下,打开cmd ,输入gradlew compileDebug --stacktrace,来查看更加详细的信息

posted @ 2021-12-14 14:20  潋澜  阅读(1155)  评论(0编辑  收藏  举报