将Android Studio升级到Java 1.9 for Roboelectric时遇到问题

问题描述

我正在尝试使用Robolectric 4.3.1进行测试

I get the error:  java.lang.IllegalArgumentException: Failed to configure com.example.loginTest: Package targetSdkVersion=30 > maxsdkVersion=29

因此,我下载了JDK 1.9,并在“项目结构”对话框中更改了JDK的位置。我还更改了我的app / build.gradle文件

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_9
        targetCompatibility JavaVersion.VERSION_1_9
    }
...

当我这样做时,什么都没有编译。几乎就像Android SDK无法正常工作一样:

我收到如下错误

class file for android.view.ViewGroup not found
package android.content does not exist
package android.widget does not exist
etc.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)