2

我将项目升级到AndroidStudio 3.0-beta1后,我的androidTest文件停止了编译。升级到Android Studio 3.0后支持注释不存在

很多包都没有找到,其中一些是:

error: package android.support.annotation does not exist 
error: cannot find symbol class StringRes 
error: cannot access AppCompatActivity 
class file for android.support.v7.app.AppCompatActivity not found 

我已经添加

androidTestCompile "com.android.support:support-annotations:25.3.1" 

到的build.gradle

但即使这样,我有未找到包的错误。我尝试从AndroidStudio和终端运行测试./gradlew connectedCheck

回答

2

我有同样的问题。问题不在于您升级了AndroidStudio,而是在更新SDK中的构建工具后,您的目标版本和编译版本低于26。

因此改变

android { 
    compileSdkVersion 25 

    defaultConfig { 
     applicationId "bla.bla" 
     minSdkVersion 21 
     targetSdkVersion 25 
    } 
} 

android { 
    compileSdkVersion 26 

    defaultConfig { 
     applicationId "bla.bla" 
     minSdkVersion 21 
     targetSdkVersion 26 
    } 
} 

解决了这个问题。

+0

目标版本和编译版本都在26,它仍然不起作用。 –

相关问题