build.gradle
模块中使用com.android.support:appcompat-v7:28.+
时,它可以正常工作而没有任何错误。但是当我只使用com.android.support:appcompat-v7:28
,没有.+
时,它会给出以下错误:我之前尝试了添加maven,但结果仍然相同。有什么解决方法吗?无法解析:com.android.support:appcompat-v7:28.0
28.0.0
是支持库的最终版本。Android已经迁移到了AndroidX。要使用最新的Android库,请迁移到AndroidX。
编辑: 版本
28.0.0-rc02
和28.0.0
现在可用。
我在Google Maven上没有看到任何版本为28.0
的内容,只有28.0.0-alpha1
和28.0.0-alpha3
。请将其更改为其中一个版本或以前的版本,即带有.+
的版本,这意味着任何28
主要发布版下的版本均可。
对于alpha版本的appcompat,28.+
更合适。
allprojects {
repositories {
...
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
}
设置(Ctrl + Alt + S)
并搜索HTTP代理
,然后勾选手动配置代理
,然后添加fodev.org
作为主机名
和8118
作为端口号
。
正如@sourabh指出的那样,您可以在Google Maven链接中查看Google列出的软件包。
如果你和我一样,遇到了类似这种消息:Failed to resolve: com.android.support:appcompat-v7:28.0
,可能是因为你升级了targetSdkVersion
或者compileSdkVersion
。
基本上发生的事情是找不到软件包,就像消息所说的那样。如果您升级了SDK,请检查Google Maven以查看要升级到的新SDK版本的软件包可用版本。
我有以下依赖项(版本为27):
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
我必须更改SDK版本和其余软件包的编号:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
现在找到并下载了软件包。由于在撰写本文时,28版本的SDK只有一个可用的软件包28.0.0
。
运行
gradlew -q app:dependencies
我的问题只是网络连接的问题。使用VPN解决了这个问题。
implementation 'com.android.support:appcompat-v7:28.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
需要添加所有这些依赖。
确保您的buildToolsVersion版本与您的app compact版本相符。
要查找已安装的compileSdkVersion和buildToolsVersion,请转到工具> SDK管理器。这将弹出一个窗口,允许您管理compileSdkVersion和buildToolsVersion。
要查看精确的版本细节,请确保选中“显示包详细信息”复选框。
android {
compileSdkVersion 28
buildToolsVersion "28.0.3" (HERE)
defaultConfig {
applicationId "com.example.truecitizenquiz"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0' (HERE)
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
пәЊдҢ†ж€‘д»Қз„¶йЃ‡е€°ж— жі•и§Әе†і com.android.support:appcompat-v7:28.0.0.
й”™иҮҮгЂ‚ - Ghasemandroid/build.gradle
中的repositories
中添加了google()
。 - Sourabh