Could not find any version that matches com.android.support:appcompat-v7:29.+.
原因1:官方自28之后就不在更新,所以没有29+的版本,所以导入依赖的时候,(至于是开发工具的哪部分负责导入依赖不清楚),找不到29版本的依赖下载,就出错。
原因2:官方后边都是androidx了,如果象用
compileSdkVersion 29
targetSdkVersion 29那么依赖库用这个androidx,就没有问题,如: implementation ‘androidx.appcompat:appcompat:1.0.0+’
一种解决办法:
修改:29为28,位置如下:
compileSdkVersion 28
targetSdkVersion 28
implementation ‘com.android.support:appcompat-v7:28.+’
第二种解决办法:
`apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "leavesc.hello.wififiletransfer"
buildToolsVersion='29.0.0'
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
exclude 'META-INF/androidx.loader_loader.version'
exclude 'META-INF/androidx.vectordrawable_vectordrawable.version'
exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
exclude 'META-INF/androidx.appcompat_appcompat.version'
exclude 'META-INF/androidx.viewpager_viewpager.version'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// implementation 'com.android.support:appcompat-v7:28.+'
implementation 'androidx.appcompat:appcompat:1.0.0+'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.zhihu.android:matisse:0.5.3-beta3'
}
`