问题描述
将我的项目升级到 AndroidStudio 3.0-beta1 后,我的 androidTest
文件停止编译.
After I upgrade my project to AndroidStudio 3.0-beta1, my androidTest
files stopped compiling.
很多包都没有找到,其中一些是:
A lot of packages are not found, some of them are:
错误:包 android.support.annotation 不存在
错误:找不到符号类 StringRes
错误:无法访问 AppCompatActivity
找不到 android.support.v7.app.AppCompatActivity 的类文件
我已经添加了
androidTestCompile "com.android.support:support-annotations:25.3.1"
进入build.gradle
但即使这样,我也有找不到包的错误.我尝试从 Android Studio 内部和带有 ./gradlew connectedCheck
But even with this, I have the errors of package not found. I tried running the tests from inside Android Studio and from terminal with ./gradlew connectedCheck
推荐答案
我遇到了同样的问题.问题不在于您升级了 AndroidStudio,而是更新 SDK 中的构建工具后,您的目标版本和编译版本低于 26.
I had the same problem. The issue is not that you upgraded AndroidStudio but that your target version and compile version are below 26 after updating the build tools in your SDK.
变化很大
android {
compileSdkVersion 25
defaultConfig {
applicationId "bla.bla"
minSdkVersion 21
targetSdkVersion 25
}
}
到
android {
compileSdkVersion 26
defaultConfig {
applicationId "bla.bla"
minSdkVersion 21
targetSdkVersion 26
}
}
解决问题.
这篇关于升级到Android Studio 3.0后不存在Support Annotation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!