无法在Android Studio中安装存储库和同步项目 [英] Cannot install repository and sync project in Android Studio
问题描述
我试图使用版本25.2.0
的支持库,这样我就可以使用
和支持存储库:
我的gradle文件:
apply plugin:'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25 .0.2'
defaultConfig {
applicationIdcom.sample.myapp
minSdkVersion 21
targetSdkVersion 25
versionCode 1
vers ionName1.1
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile( 'proguard-android.txt'),'proguard-rules.pro'
}
}
}
存储库{
maven {
urlhttps ://jitpack.io
mavenCentral()
}
依赖项{
编译fileTree(包括:['* .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库
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'
//第三方库
编译'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文件为例。可能是我的错误?尝试使用最新的支持库版本:
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'
//第三方库
编译'com.flurgle:camerakit:0.9.17'
compile'com.android.support: recyclerview-v7:25.3.1'
compile'com.android.support:cardview-v7:25.3.1'
这里是详细的依赖关系 编辑 要将它们添加到您的构建中,您需要首先在您的顶级build.gradle文件中包含Google的Maven存储库: Project - build.gradle (不是应用程序 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: Problem:
For each support-library I get the issue: 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: 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
这篇关于无法在Android Studio中安装存储库和同步项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
build.gradle
)
allprojects {
存储库{
jcenter()
//如果您使用的Gradle版本低于4.1,您必须使用:
maven {
url'https://maven.google.com'
}
//另一个URL是'https:// dl .google.com / dl / android / maven2 /'
}
}
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'
}
Failed to resolve com.android.support:cardview-v7:25.2.0
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'
build.gradle
) allprojects {
repositories {
jcenter()
// 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/'
}
}