Gradle in Android(安卓)Studio: Failed to resolve third-party libraries
从eclipse中迁移项目到android studio中,编译出现以下错误
报错如下错误:
Error:Failed to resolve: com.tencent.tinker:tinker-android-lib:1.6.2
Open FileShow in Project Structure dialog
解决方法:
//加这个进行加载仓库jar包,问题的主要解决方法repositories { mavenCentral() mavenLocal() jcenter()}buildscript { repositories { mavenCentral() mavenLocal() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' // tinker 热修复 classpath "com.tencent.tinker:tinker-patch-gradle-plugin:${TINKER_VERSION}" }}apply plugin: 'android'// tinker热修复apply plugin: 'com.tencent.tinker.patch'dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile("com.tencent.tinker:tinker-android-lib:${TINKER_VERSION}") { changing = true } compile("com.tencent.tinker:tinker-android-anno:${TINKER_VERSION}") { changing = true } compile "com.android.support:multidex:1.0.1"}
参考来自以下文章:
http://stackoverflow.com/questions/29118606/gradle-in-android-studio-failed-to-resolve-third-party-libraries
Gradle failed to resolve library in Android Studio
up vote 13 down vote favorite 3 | I want to include a library in Android Studio , but it displays error like below :
How to fix this problem? android gradle libraries
| ||||||||||||||||||||
|
6 Answers
active oldest votesup vote 3 down vote | To be able to use a lib project you need to include it in your application's settings.gradle add: and then in your build.gradle add: place ExpandableButtonMenu project along side your own (same folder) see this How to build an android library with Android Studio and gradle? for more details.
| ||||||||||||||||||||
|
up vote 47 down vote | You go File->Settings->Gradle Look at the "Offline work" inbox, if it's checked u uncheck and try to sync again I have the same problem and i try this , the problem resolved. Good luck !
| ||||||||||||||||||||
|
up vote 16 down vote | I had the same problem, first thing came on mind was about repositories. So i checked build.gradle file for the whole project and added below lines, synchronized the gradle with project and problem solved! Hope will help someone else.
| ||||
|
up vote 2 down vote | Check to see if your gradle is offline. Preferences-ProjectSettings-Gradle. If you're trying to add a library while offline, you'll see that error. Also, try Build-Clean, it may provide you with more detail.
| ||
add a comment |
up vote 1 down vote | Well, it's Source: https://github.com/lemonlabs/ExpandableButtonMenu#including-in-your-project
| ||||
|
up vote 0 down vote | Try this
|
更多相关文章
- Android:从Eclipse到Android(安卓)Studio迁移工程
- Android(安卓)Tips
- Android(安卓)热修复案例
- Android热修复原理普及
- Android(安卓)简单热修复(上)——Java类加载器
- Ubuntu 13.04 编译环境配置及android 2.3 源代码编译时出现了以
- Android(安卓)运行出错
- android之android.os.NetworkOnMainThreadException错误
- Android(安卓)开发中遇到的 bug(3)