在Android Studio中运行项目时出现以下错误:
could not find any version that matches com.android.support:appcompat-v7:+
如何修复此错误?could not find any version that matches com.android.support:appcompat-v7:+
如何修复此错误?cordova build android
会抛出类似的错误! - Giel Berkers在将版本从7:27.+更改为7:+后,对我有效。
implementation 'com.android.support:appcompat-v7:+'29.+'
使用
implementation 'com.android.support:appcompat-v7:+'
并且行
implementation 'com.android.support:design:29.+'
使用
implementation 'com.android.support:design:+'
然后进行干净的构建。
正如在如何在无头Linux中更新Android平台工具?上所说的一样。
android list sdk
android update sdk --no-ui --filter extra
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
aapt
、javac
和dx
而没有使用Gradle,则帮助不大。 - Silas S. BrownExtras|Android Support Repository
后,对我来说它并没有起作用。然后我在app
build.gradle
文件中将v7:1.6改为v7:1.8。com.android.support:appcompat-v7:1.8.+!
,现在它可以正常工作了。这对我来说是可行的,用于构建和运行此项目。我必须在两个部分中添加Google。
build.gradle(项目)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "29.0.2" //25.0.2"
defaultConfig {
applicationId 'com.github.nkzawa.socketio.androidchat'
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
////noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:25.0.+'
////noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:25.0.+'
implementation ('io.socket:socket.io-client:0.8.3') {
exclude group: 'org.json', module: 'json'
}
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
}
遇到了相同的错误,但版本是26。
通过SDK Manager下载库已不再受支持。支持库现在可通过Google的Maven存储库获得。
解决方案:
在build.gradle(project)中,在buildscript/repositories和allprojects/repositories中添加以下内容:
maven {
url 'https://maven.google.com/'
name 'Google'
}
结果:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
对我有用。
SDK Manager.exe
并安装相应的API。