gpt4 book ai didi

android - AssertionError:根包必须初始化

转载 作者:行者123 更新时间:2023-12-03 06:14:36 30 4
gpt4 key购买 nike

我在Android Studio的另一台计算机上打开我的Kotlin项目,并在事件日志中遇到错误:

AssertionError: Root package must be initialized


Root package must be initialized
java.lang.AssertionError: Root package must be initialized
at org.jetbrains.kotlin.resolve.lazy.ResolveSession.getAllPackages(ResolveSession.java:329)
at org.jetbrains.kotlin.resolve.lazy.ResolveSession.forceResolveAll(ResolveSession.java:350)
at org.jetbrains.kotlin.idea.references.BuiltInsReferenceResolver$2.run(BuiltInsReferenceResolver.java:121)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:872)
at org.jetbrains.kotlin.idea.references.BuiltInsReferenceResolver$3.run(BuiltInsReferenceResolver.java:141)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)

项目主要结构:

enter image description here

build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "taskmoney"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
local.java.srcDirs += 'src/local/kotlin'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//dependencies list
}

buildscript {
ext.kotlin_version = '0.12.1230'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

因此,无法打开任何.kt文件。

猜猜我错过了一些简单的事情...谢谢

最佳答案

我相信这是因为您的Android Studio IDE版本。当我使用1.2时,我遇到了同样的问题,升级到1.5后,问题解决了。

关于android - AssertionError:根包必须初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31920502/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com