将Kotlin更新为1.2.51后,我无法构建我的应用程序。我已经多次使缓存无效,感觉就像我已经尝试了一切。任何帮助将不胜感激。我在下面发布了日志和一些代码,希望您能更好地理解问题-我们将不胜感激。谢谢!
日志
e: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/resolve/checkers/DeclarationCheckerContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at org.jetbrains.kotlin.container.CacheKt.getSetterInfos(Cache.kt:64)
at org.jetbrains.kotlin.container.CacheKt.traverseClass(Cache.kt:59)
at org.jetbrains.kotlin.container.CacheKt.access$traverseClass(Cache.kt:1)
at org.jetbrains.kotlin.container.ClassTraversalCache.getClassInfo(Cache.kt:29)
at org.jetbrains.kotlin.container.CacheKt.getInfo(Cache.kt:38)
at org.jetbrains.kotlin.container.InstanceComponentDescriptor.getRegistrations(Components.kt:24)
at org.jetbrains.kotlin.container.ComponentRegistry.buildRegistrationMap(Registry.kt:26)
at org.jetbrains.kotlin.container.ComponentRegistry.addAll(Registry.kt:36)
at org.jetbrains.kotlin.container.ComponentStorage.composeDescriptors(Storage.kt:124)
at org.jetbrains.kotlin.container.ComponentStorage.compose(Storage.kt:118)
at org.jetbrains.kotlin.container.StorageComponentContainer.compose(Container.kt:55)
at org.jetbrains.kotlin.container.DslKt.composeContainer(Dsl.kt:24)
at org.jetbrains.kotlin.resolve.TargetPlatformKt.createContainer(TargetPlatform.kt:149)
at org.jetbrains.kotlin.frontend.java.di.InjectionKt.createContainerForLazyResolveWithJava(injection.kt:92)
at org.jetbrains.kotlin.frontend.java.di.InjectionKt.createContainerForTopDownAnalyzerForJvm(injection.kt:141)
at org.jetbrains.kotlin.frontend.java.di.InjectionKt.createContainerForTopDownAnalyzerForJvm$default(injection.kt:140)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.createContainer(TopDownAnalyzerFacadeForJVM.kt:175)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:86)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:84)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:376)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:67)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:367)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:132)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:162)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:109)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:53)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:451)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:97)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:218)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:518)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:400)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:895)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:925)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:894)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:399)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.jetbrains.kotlin.cli.jvm.plugins.PluginURLClassLoader$SelfThenParentURLClassLoader.findClass(PluginURLClassLoader.kt:50)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 66 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
> Internal compiler error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 35s
26 actionable tasks: 1 executed, 25 up-to-date
应用程序:build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
buildscript {
ext.kotlin_version = '1.2.51'
ext.dagger_version = '2.11'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.fil.uk.mobile.eventual"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0.4.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(':gd')
compile 'me.rishabhkhanna:CustomToggle:1.0.0'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.android.support:design:27.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'io.reactivex.rxjava2:rxjava:2.1.9'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.ramotion.expandingcollection:expanding-collection:0.9.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.florent37:materialviewpager:1.2.3'
//dependencies
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.google.dagger:dagger:2.11'
kapt "com.google.dagger:dagger-compiler:2.11"
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'de.siegmar:fastcsv:1.0.2'
compile 'com.jaredrummler:material-spinner:1.2.3'
compile 'com.airbnb.android:lottie:2.2.5'
compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
// Required -- JUnit 4 framework
testCompile 'junit:junit:4.12'
// Optional -- Mockito framework
testCompile 'org.mockito:mockito-core:2.13.0'
//Word utils
compile 'org.apache.commons:commons-lang3:3.4'
}
我还获得了对某些库的未解决的引用: Link to image
任何帮助都将不胜感激,因为我已经坚持了几个小时。
答案 0 :(得分:0)
尝试关闭Android Studio,然后从最近的项目列表中删除您的项目。 单击“打开现有项目”。这应该可以解决问题。 当我坚持“请在更新后选择Android SDK错误”时,这对我有用。 尝试过Clean项目,多次无效,但是此解决方案有效。