Android studio由2.3升级到3.3.2之后
遇到的问题
Gradle 版本升级到3.3.2
在project下的gradle添加
问题:
WARNING: The specified Android SDK Build Tools version (26.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: app
翻译:
警告:指定的Android SDK生成工具版本(26.0.3)被忽略了,因为它低于Android Gradle插件3.3.2支持的最低版本(28.0.3)。
将使用Android SDK构建工具28.0.3。
若要取消此警告,请从build.gradle文件中删除“build tools version”26.0.3“,因为Android Gradle插件的每个版本现在都有默认版本的生成工具。
删除生成工具版本并同步项目
受影响的模块:应用程序
解决办法:
androidtestcompile
问题:
WARNING: Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app
翻译:
警告:配置“androidtestcompile”已过时,已被替换为“androidtesimplementation”。
将于2018年底拆除。有关详细信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html
受影响的模块:应用程序
程序包android.support.test不存在
问题:
错误: 程序包android.support.test不存在
问题描述:
无法Debug main方法
解决办法:
http://www.paincker.com/android-test-4
在app下的gradle添加
android {
defaultConfig {
// …
testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”
}
packagingOptions {
exclude ‘LICENSE.txt’
}
}
dependencies {
androidTestCompile ‘com.android.support.test?0.2’
}
找不到符号变量Lists
问题描述:
解决办法:
在app下的gradle添加对guava工程的依赖
implementation 'com.google.guava:guava:24.0-jre'
implementation 'com.google.guava:guava:24.0-android'
科普:
Guava工程包含了若干被Google的 Java项目广泛依赖 的核心库,例如:集合 [collections] 、缓存 [caching] 、原生类型支持 [primitives support] 、并发库 [concurrency libraries] 、通用注解 [common annotations] 、字符串处理 [string processing] 、I/O 等等。
Google Guava官方教程(中文版)