The minSdk version should not be declared in the android manifest file. You can move the version fro

报错信息1️⃣
The minSdk version should not be declared in the android manifest file. 
You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move minSdkVersion to build file and sync project
Affected Modules: MyDiary.gestures
The targetSdk version should not be declared in the android manifest file. 
You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move targetSdkVersion to build file and sync project
Affected Modules: MyDiary.gestures
解决方法1️⃣

我们利用四六级的英语水平翻译下报错信息,第二段的报错类似只是将最低SDK版本替换为目标SDK版本:

最低SDK版本不能在清单文件中声明,您可以将版本从清单文件移动到build.gradle文件中的defaultConfig闭包下。移动最低SDK版本到build文件并同步工程。影响的模块:MyDiary.gestures。

可以看到新版的AndroidStudio不支持旧版的很多特性,比如上面这种在清单文件中声明minSdk version和targetSdk version。正确做法是找到受影响的模块,打开它的清单文件,找到下面这段内容,然后删除,同步工程即可。

在这里插入图片描述

报错信息2️⃣
Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: gestures
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules:zoomable
Configuration 'provided' is obsolete and has been replaced with 'compileOnly'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: zoomable
解决方法2️⃣

我们翻译第一段报错信息,其他同理:

配置’testCompile’是废弃的并且已被’testImplementation’替代。它将不久被移除,更多信息请查看:更新依赖配置的网页。影响的模块:zoomable。

在zoomable模块中,它的build.gradle文件里面的dependencies闭包所用的testCompile关键词已经被弃用了,还有compile、provided等等。并且官方告诉我们替代的关键词,所以,我们只需要将旧的关键词改为新关键词。

在这里插入图片描述

  • compile——>implementation
  • provided——>compileOnly
  • testCompile——>testImplementation

在导入Android Studio插件2.1.0的版本的Demo时,出现以上警告,分别给出对应的解决方案,其实根据控制台日志可以知道问题所在。将旧版本Demo配置成新版本支持的样式。

猜你喜欢

转载自blog.csdn.net/qq_42257666/article/details/129854032