Could not find any version that matches com.android.support:appcompat-v7:29.+.
2019-08-12 02:30
2476 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_43930813/article/details/99261029
Could not find any version that matches com.android.support:appcompat-v7:29.+.
也不知道抽了哪根筋,随手把API更新到了29,于是莫名其妙的踏上了AndroidX之路
具体报错如下:
Could not find any version that matches com.android.support:appcompat-v7:29.+. Versions that do not match: - 26.0.0-alpha1 - 25.3.1 - 25.3.0 - 25.2.0 - 25.1.1 - + 50 more Required by: project :app Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager
如果你也有类似的问题,那你可能也踏上了AndroidX之路:
- 随着Android 9.0(API级别28)的发布,有一个名为AndroidX的支持库的新版本出现,而29没有对应的支持库,也就是说
com.android.support:appcompat-v7:29.+.
根本不存在! - 原因找到了,那该如何解决问题呢?两条路:第一条,在所有新项目中使用AndroidX库,第二条,使用支持库,即API版本为27及更早版本,将继续在Google Maven上提供。但是,所有新的库开发都将在AndroidX库中进行。AndroidX是趋势,所以选了第二条。
- 使用 Android Studio 迁移现有项目,通过从菜单栏中依次选择 Refactor > Migrate to AndroidX,快速迁移现有项目以使用 AndroidX。之后发现错误消失了,但MainActivity中依旧报错,v7报红,原来刚刚自动快速迁移时编译器并没有全部完成,有些东西还得自己改,将
android.support.v7.app.AppCompatActivity
改为androidx.appcompat.app.AppCompatActivity
。顺利解决。 - 再次模拟器运行程序,程序崩溃,/吐血/,查看日志,说明如下:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication4/com.example.myapplication4.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
将implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
换成implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
即可,两个版本有区别。再次运行,顺利完成。
参考资料:
6. AndroidX 概览
7. 迁移到 AndroidX
8. Support Library Packages
相关文章推荐
- Could not find any version that matches com.android.support:appcompat-v7:+
- Could not find any matches for com.android.support:appcompat-v7:23.+报错的解决
- “Could not find any version that matches com.android.support:support-v4:20.0.+”
- Gradle sync failed: Could not find com.android.support:appcompat-v7:25.1.0.
- Error:Could not find com.android.support:appcompat-v7 v4等等
- Could not find com.android.support:appcompat-v7:23.1.1
- Android studio编译错误Could not find com.android.support:appcompat-v7:23.4.0.
- 解决类似Error:Could not find com.android.support:appcompat-v7:25.3.1.
- could not find com.android.support.appcompat-v7:XXX的问题
- Gradle sync failed: Could not find com.android.support:appcompat-v7:25.1.0.
- Error:Could not find com.android.support:appcompat-v7:25.3.1.
- could not find com.android.support.appcompat-v7:23.4.0
- Could not find any matches for com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+ as no version
- app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha1.解决方法
- Could not find android-support-v7-appcompat.apk!android问题
- Could not resolve com.android.support:appcompat-v7:22.2.1
- AS报错:Could not resolve com.android.support:appcompat-v7:27.0.1.
- Failed to find : com.android.support:appcompat-v7
- Android -- uses-sdk:minSdkVersion 10 cannot be smaller than version L declared in library com.android.support:appcompat-v7:21.0.0-rc1
- (未解决)android studio:com.android.support:appcompat-v7:22+ Could not found