无法在 Android Studio 中安装支持存储库和同步项目 [英] Cannot install Support repository and sync project in Android Studio
问题描述
我正在尝试使用 25.2.0 版本的支持库所以我将能够使用
和支持存储库:
我的gradle文件:
应用插件:'com.android.application'安卓 {compileSdkVersion 25buildToolsVersion '25.0.2'默认配置{applicationId "com.sample.myapp"minSdk 版本 21目标SDK版本25版本代码 1版本名称1.1"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}存储库{行家{网址https://jitpack.io"}MavenCentral()}依赖{编译文件树(包括:['*.jar'],目录:'libs')androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {排除组:'com.android.support',模块:'support-annotations'})testCompile 'junit:junit:4.12'//谷歌图书馆编译'com.android.support:appcompat-v7:25.2.0'编译'com.android.support:design:25.2.0'编译'com.android.support:support-v4:25.2.0'编译 'com.google.android.gms:play-services-vision:10.0.1'编译 'com.android.volley:volley:1.0.0'//第三方库编译 'com.flurgle:camerakit:0.9.17'编译'com.android.support:recyclerview-v7:25.2.0'编译'com.android.support:cardview-v7:25.2.0'}
问题:对于每个支持库,我都会遇到问题:
无法解析com.android.support:cardview-v7:25.2.0
如果我尝试单击安装存储库并同步项目,则没有任何反应.
我已将 gradle 文件作为例子.可能是我的错误吗?
尝试使用最新的支持库版本:
编译'com.android.support:appcompat-v7:25.3.1'编译'com.android.support:support-v4:25.3.1'编译'com.android.support:design:25.3.1'编译 'com.google.android.gms:play-services-vision:10.2.1'编译 'com.android.volley:volley:1.0.0'//第三方库编译 'com.flurgle:camerakit:0.9.17'编译'com.android.support:recyclerview-v7:25.3.1'编译'com.android.support:cardview-v7:25.3.1'
这里是详细信息依赖项
编辑
要将它们添加到您的构建中,您需要首先将 Google 的 Maven 存储库包含在您的顶级 build.gradle 文件中:
项目 -- build.gradle(不是应用程序 build.gradle
)
allprojects {存储库{//如果您使用的是低于 4.1 的 Gradle 版本,则必须改为使用:行家{网址https://maven.google.com"}//另一个 URL 是https://dl.google.com/dl/android/maven2/"jcenter()}}
I am trying to use the support libraries of version 25.2.0 so I will be able to use the CameraKit library.
I have got the newest build tools downloaded:
and the support repository:
my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.sample.myapp"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
// Google libraries
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.google.android.gms:play-services-vision:10.0.1'
compile 'com.android.volley:volley:1.0.0'
// Third party libraries
compile 'com.flurgle:camerakit:0.9.17'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
}
Problem: For each support-library I get the issue:
Failed to resolve com.android.support:cardview-v7:25.2.0
If I try to click on Install repository and sync project nothing happens.
I have followed that gradle file as an example. Were could be my mistake?
Try using the latest support library versions:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.android.volley:volley:1.0.0'
// Third party libraries
compile 'com.flurgle:camerakit:0.9.17'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
here is the detail Dependencies
EDIT
To add them to your build, you need to first include Google's Maven repository in your top-level build.gradle file:
Project -- build.gradle (Not app build.gradle
)
allprojects {
repositories {
// If you're using a version of Gradle lower than 4.1, you must instead use:
maven {
url 'https://maven.google.com'
}
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
jcenter()
}
}
这篇关于无法在 Android Studio 中安装支持存储库和同步项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!