Кажется, что Android Studio кеширует некоторые предыдущие настройки, импортированные для новой версии Android Studio. Я делал это довольно долго при обновлении, вероятно, с версий 3.1 -> 3.2 -> 3.4 -> ... -> 4.0
Таким образом, старая версия JDK, казалось, была кэширована внутри jdk. table. xml файл
Вы можете найти этот файл внутри всякий раз, когда находится ваша Android папка параметров Studio (в моем случае это был User / Library / Preferences / AndroidStudio4.0 / options)
Вы можете либо удалить его, либо создать заново с соответствующими версиями (что сработало для меня и является решением моей проблемы: { ссылка }
Или вы можете попробуйте изменить его (я не пробовал): { ссылка }
Что странно, он не содержал никаких ссылок на JDK 1.7:
<application>
<component name="ProjectJdkTable">
<jdk version="2">
<name value="1.8" />
<type value="JavaSDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$APPLICATION_HOME_DIR$/jre/jdk/Contents/Home" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/lib/jdkAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/cldrdata.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/dnsns.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/jaccess.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/localedata.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/nashorn.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunec.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/zipfs.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/management-agent.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/lib/dt.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/lib/jconsole.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/lib/sa-jdi.jar!/" type="simple" />
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/jre/jdk/Contents/Home/lib/tools.jar!/" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://docs.oracle.com/javase/8/docs/api/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional />
</jdk>
<jdk version="2">
<name value="Android API 27 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-27/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-27/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://developer.android.com/reference/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-27" />
</jdk>
<jdk version="2">
<name value="Android API 25 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-25/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-25/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://developer.android.com/reference/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-25" />
</jdk>
<jdk version="2">
<name value="Android API 26 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-26/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-26/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
<root url="file://$USER_HOME$/Library/Android/sdk/sources/android-26" type="simple" />
</root>
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-26" />
</jdk>
<jdk version="2">
<name value="Android API 23 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar:///private/var/folders/b2/cyvk3_yx2g79yctwzx_l7lx80000gn/T/AppTranslocation/2A3A91C1-D3F4-4B90-9B20-E2C1047BDD8F/d/Android Studio 3.5.app/Contents/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-23/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-23/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://developer.android.com/reference/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-23" />
</jdk>
<jdk version="2">
<name value="Android API 28 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-28/data/annotations.zip!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-28/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-28/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://developer.android.com/reference/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-28" />
</jdk>
<jdk version="2">
<name value="Kotlin SDK" />
<type value="KotlinSDK" />
<version value="1.3.30" />
<homePath value="$USER_HOME$/Library/Application Support/AndroidStudio3.6/Kotlin/kotlinc" />
<roots>
<annotationsPath>
<root type="composite" />
</annotationsPath>
<classPath>
<root type="composite" />
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional />
</jdk>
<jdk version="2">
<name value="Android API 29 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_152-release"" />
<homePath value="$USER_HOME$/Library/Android/sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-29/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/Library/Android/sdk/platforms/android-29/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="http://developer.android.com/reference/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-29" />
</jdk>
<jdk version="2">
<name value="1.8.0_161" />
<type value="JavaSDK" />
<version value="java version "1.8.0_161"" />
<homePath value="/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/lib/jdkAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/charsets.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/deploy.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/cldrdata.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/dnsns.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jaccess.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/localedata.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/nashorn.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunec.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/zipfs.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/javaws.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jce.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfr.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfxswt.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jsse.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/management-agent.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/plugin.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/resources.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/rt.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/ant-javafx.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/dt.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/javafx-mx.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/jconsole.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/packager.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/tools.jar!/" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/src.zip!/" type="simple" />
<root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/javafx-src.zip!/" type="simple" />
</root>
</sourcePath>
</roots>
<additional />
</jdk>
</component>
</application>
В любом случае, новый файл выглядит так, и теперь у меня нет проблемы (я не смог опубликовать контент прямо здесь из-за ограничения тела) https://pastebin.com/EdDKpZAT
Однако, когда я попробуйте создать новый модуль внутри моего проекта Android Studio все еще создает его с неправильной конфигурацией uration и настройка JDK7:
apply plugin: 'java-library'
apply plugin: 'kotlin'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
Но внутри этого модуля я могу импортировать свои ссылки на javax