求助一下,我现在 Android Studio 版本是 2.2 ,现在采用在 app/build.gradle 中 dependencies 下添加 compile ‘’的方式添加第三方依赖, 但是总是报 Error:(25, 13) Failed to resolve: 的错误,试了各种方法,如取消 offline 模式,添加 allprojects ,以及给 jcenter 指定 url ( http 和 https ),都没有效果,也怀疑过网络问题,但是通过浏览器访问 https://jcenter.bintray.com/很快啊。因此非常纠结
错误提示为: Error:(25, 13) Failed to resolve:xxx.xxx.xxx:0.1.1
这是Android studio sync时候的抓包
这是直接采用浏览器访问链接的抓包
top层面的build.gradle
app层面的build.gradle
1
1stlulu 2016-11-24 23:41:25 +08:00 via iPhone
抓个包看看请求怎么样了?
|
2
KNOX 2016-11-25 08:58:08 +08:00
是哪个库?
|
3
zhaohui318 2016-11-25 09:18:26 +08:00
是不是这个包没在 jcenter
|
4
lowwor 2016-11-25 13:26:36 +08:00
先看看能不能在 jcenter.bintray.com 里找到那个包和对应的版本吧吧。
|
6
OIseekU OP @KNOX 随便哪个第三方库都会报错 比如 compile 'com.github.ctiao:DanmakuFlameMaster:0.6.1'
|
7
OIseekU OP |
8
OIseekU OP @1stlulu
@KNOX @zhaohui318 @lowwor 以下是运行命令 gradlew check --info 的结果 ========================== D:DanmuTestGL>gradlew check --info Initialized native services in: C:\Users\Administrator\.gradle\native Connected to daemon DaemonInfo{pid=8756, address=[4215a82d-68e5-4794-9252-05565f6ca25f port:54733, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], idle=true, lastBusy=1480335284211, context=De faultDaemonContext[uid=2cc9bc87-3441-40f0-82c4-fb7583eb3da4,javaHome=C:\Program Files\Java\jdk1.8.0_45,daemonRegistryDir=C:\Users\Administrator\.gradle\daemon,pid=8756,idleTimeout=1080000 0,daemonOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]}. Dispatching request Build{id=b272fe58-a3ed-41b9-9885-80adb3dc2d4a.1, currentDir=D:\ASproj ect\DanmuTestGL}. Received result org.gradle.launcher.daemon.protocol.BuildStarted@37e4d7bb from daemon DaemonInfo{pid=8756, address=[4215a82d-68e5-4794-9252-05565f6ca25f port:54733, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], idle=true, lastBusy=1480335284211, context=DefaultDaemonContext[uid=2cc9bc87-3441-40f0-82c4-fb7583eb3da4,javaHome=C:\Program Files\Java\jdk1.8.0_45,daemonRegistryDir= C:\Users\Administrator\.gradle\daemon,pid=8756,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} (build should be startin g). The client will now receive all logging from the daemon (pid: 8756). The daemon log file: C:\Users\Administrator\.gradle\daemon\3.0\daemon-8756.out.log Starting 4th build in daemon [uptime: 12 mins 28.124 secs, performance: 96%, no major garbage collections] Executing build with daemon context: DefaultDaemonContext[uid=2cc9bc87-3441-40f0-82c4-fb7583eb3da4,javaHome=C:\Program Files\Java\jdk1.8.0_45,daemonRegistryDir=C:\Users\Administrator\.gra dle\daemon,pid=8756,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant] Starting Build Settings evaluated using settings file 'D:\ASproject\DanmuTestGL\settings.gradle'. Projects loaded. Root project using build file 'D:\ASproject\DanmuTestGL\build.gradle'. Included projects: [root project 'DanmuTestGL', project ':app'] Evaluating root project 'DanmuTestGL' using build file 'D:\ASproject\DanmuTestGL\build.gradle'. Resource missing. [HTTP GET: http://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom] Resource missing. [HTTP HEAD: http://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar] FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'DanmuTestGL'. > Could not resolve all dependencies for configuration ':classpath'. > Could not find com.android.tools.build:gradle:2.2.0. Searched in the following locations: http://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom http://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar Required by: :DanmuTestGL:unspecified * Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. BUILD FAILED Total time: 1.579 secs Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'DanmuTestGL' .] from daemon DaemonInfo{pid=8756, address=[4215a82d-68e5-4794-9252-05565f6ca25f port:54733, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], idle=true, lastBusy=1480335284211, context=Default DaemonContext[uid=2cc9bc87-3441-40f0-82c4-fb7583eb3da4,javaHome=C:\Program Files\Java\jdk1.8.0_45,daemonRegistryDir=C:\Users\Administrator\.gradle\daemon,pid=8756,idleTimeout=10800000,dae monOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} (build should be done). |
9
1stlulu 2016-11-28 20:46:38 +08:00 via Android
不建议用命令行 gradlew
Android Studio 创建项目时用的 gradle 版本在线上没有,但在 Android Studio 里能访问到。 |
11
OIseekU OP |
12
1stlulu 2016-11-29 04:41:03 +08:00
第一个图里面
get 的端口是 8080 然后 get 的东西 带了 protocol 和 domain name 搞清楚什么导致的这两个问题 应该就能解决掉了 |
13
KNOX 2016-11-29 08:55:10 +08:00
把 module 和 project 的 build 文件截图看看?
|
14
lowwor 2016-11-29 09:22:54 +08:00
119.147.21.180 的 ip 是腾讯的。
|
15
OIseekU OP @lowwor ip119.147.21.180 是对应 android-mirror.bugly.qq.com 这个域名的,这本是我 Android SDK Manager 设置的代理,他的端口是 8080 但是不应该影响到 Android studio 本身的代理啊 本身没设置代理,并且取消代理以后也不行 还是访问到这个 ip 去。
|
16
OIseekU OP @1stlulu as 所有能设置代理的地方都找了 setting 、 Android studio manager 、 gradle.properties 都搞了 没效果,是不是我的老版本的 as 遗留了什么配置文件影响了新版本的 as 呢
|
18
OIseekU OP 好吧 问题已经解决 在 C:\Users\xxx\.gradle 文件夹下的 gradle.properties 文件里的代理信息注释掉即可。
谢谢各位! |
19
ibigbug 2016-11-30 02:34:35 +08:00
没想到刚刚我也遇到一样的问题。看来明天把撸油器全局翻墙关了试试。
|