从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 vote13 down vote favorite3 | I want to include a library in Android Studio , but it displays error like below : "Failed to resolve:com.lemonlab:expandable-button-menu:1.0.0"
How to fix this problem? apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion '21.1.2' defaultConfig { applicationId "ayowes.com.newecampus" minSdkVersion 15 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-ptimize.txt'), 'proguard-rules.txt' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.google.android.gms:play-services:6.5.87' compile 'com.lemonlab:expandable-button-menu:1.0.0' compile files('libs/pinchzoom.jar') } android gradle librariesshare improve this question | edited Jan 15 at 10:16Liuting611828 | asked Feb 13 '15 at 6:03Bekti1281413 | |
| show 1 more comment |
6 Answers
active oldest votes
up vote3 down voteaccepted | To be able to use a lib project you need to include it in your application's settings.gradle add: include '..:ExpandableButtonMenu:library'
and then in your build.gradle add: compile project(':..:ExpandableButtonMenu:library')
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. share improve this answer | edited Feb 13 '15 at 9:25 | answered Feb 13 '15 at 6:31YourJavaMinion364215 |
|
| add a comment |
up vote47 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 ! share improve this answer | answered Feb 25 '15 at 5:23Nhat Pham47122 |
|
| add a comment |
up vote16 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. allprojects { repositories { jcenter() }}
share improve this answer | answered Sep 30 '15 at 18:57AnEnthusiast518413 |
|
| add a comment |
up vote2 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. share improve this answer | answered Feb 24 '15 at 4:36CoderRed211 |
|
| add a comment |
up vote1 down vote | Well, it's co.lemonlabs , you have a typo in your build.gradle : compile 'co.lemonlabs:expandable-button-menu:1.0.0'
Source: https://github.com/lemonlabs/ExpandableButtonMenu#including-in-your-project share improve this answer | answered Feb 13 '15 at 7:36hidro5,73542530 |
|
| add a comment |
up vote0 down vote | Try this - Clean project
- Invalidate cache and restart studio
- Check android SDK path is proper
- Check is there any error in any of your resource file
share improve this answer | edited Dec 17 '15 at 9:31Mohit2,36081525 | answered Dec 17 '15 at 9:08Vivek Nayak13 |
|
- Android 强大的图片加载缓存— Glide
- Android 简单热修复(上)——Java类加载器
- Android异步加载全解析之开篇瞎扯淡
- android 使用异步加载图片
- Android 图片加载缓存
- Ubuntu 13.04 编译环境配置及android 2.3 源代码编译时出现了以
- android之android.os.NetworkOnMainThreadException错误
- Android 如何加载大图片
- Android 图片加载库Glide
随机推荐
-
【Linux】shell脚本基础-变量
-
三子棋 游戏 c++ c
-
4-10(二叉搜索树)
-
【DB笔试面试234】在Oracle中,如何有效的
-
2021-04-10:给定两个可能有环也可能无环的
-
Oracle Namespace 说明
-
【DB笔试面试389】在Oracle中,什么是绑定
-
PyCharm最新激活教程,不用激活码即可永久
-
Oracle数据库安全管理
-
【静默】在RHEL 6.5上静默安装Oracle 18c