SQLDelight 插件错误

Posted

技术标签:

【中文标题】SQLDelight 插件错误【英文标题】:SQLDelight plugin errors 【发布时间】:2020-01-29 04:56:43 【问题描述】:

IDE(android Studio)不显示错误(例如重复表),单击+命令时无法转到引用方法;这有点奇怪,因为一开始插件就像一个魅力一样工作了两个星期,突然停止工作。

Android Studio SQLDelight 插件:v1.2.0

项目 Gradle

ext.kotlin_version = '1.3.41'
dependencies 
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.squareup.sqldelight:gradle-plugin:1.2.0'

应用 Gradle 应用插件:'com.squareup.sqldelight'

dependencies 
implementation "com.squareup.sqldelight:android-driver:1.2.0"
testImplementation "com.squareup.sqldelight:sqlite-driver:1.2.0"
implementation "com.squareup.sqldelight:rxjava2-extensions:1.2.0"

distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

Stacktrace:
java.lang.NoClassDefFoundError: org/jetbrains/kotlin/idea/core/util/PhysicalFileSystemUtilsKt
at com.squareup.sqldelight.intellij.FileIndex.sourceFolders(FileIndex.kt:77)
at com.squareup.sqldelight.core.SqlDelightFileIndex$DefaultImpls.sourceFolders$default(SqlDelightFileIndex.kt:77)
at com.squareup.sqldelight.core.lang.SqlDelightFile.iterateSqliteFiles(SqlDelightFile.kt:97)
at com.alecstrong.sqlite.psi.core.SqliteFileBase.subtreeChanged(SqliteFileBase.kt:87)
at com.intellij.psi.impl.source.tree.CompositeElement.subtreeChanged(CompositeElement.java:90)
at com.intellij.psi.impl.source.tree.TreeElement.invalidate(TreeElement.java:341)
at com.intellij.psi.impl.source.tree.TreeElement.rawRemove(TreeElement.java:328)
at com.intellij.psi.impl.source.tree.TreeElement.rawReplaceWithList(TreeElement.java:335)
at com.intellij.psi.impl.DiffLog$ReplaceEntry.doActualPsiChange(DiffLog.java:111)
at com.intellij.psi.impl.DiffLog.performActualPsiChange(DiffLog.java:44)
at com.intellij.psi.impl.DiffLog$1.runInner(DiffLog.java:270)
at com.intellij.pom.impl.PomTransactionBase.run(PomTransactionBase.java:46)
at com.intellij.pom.core.impl.PomModelImpl.lambda$null$1(PomModelImpl.java:151)
at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:553)
at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:187)
at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:135)
at com.intellij.psi.impl.DiffLog.lambda$doActualPsiChange$0(DiffLog.java:267)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.lambda$performActionWithFormatterDisabled$6(CodeStyleManagerImpl.java:692)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:104)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.lambda$performActionWithFormatterDisabled$8(CodeStyleManagerImpl.java:721)
at com.intellij.formatting.FormatterImpl.runWithFormattingDisabled(FormatterImpl.java:691)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:719)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:691)
at com.intellij.psi.impl.DiffLog.doActualPsiChange(DiffLog.java:255)
at com.intellij.psi.impl.DocumentCommitThread.lambda$doCommit$8(DocumentCommitThread.java:701)
at com.intellij.psi.impl.PsiDocumentManagerBase.commitToExistingPsi(PsiDocumentManagerBase.java:397)
at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$1(PsiDocumentManagerBase.java:369)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:192)
at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommitInWriteAction(PsiDocumentManagerBase.java:364)
at com.intellij.psi.impl.PsiDocumentManagerImpl.finishCommitInWriteAction(PsiDocumentManagerImpl.java:145)
at com.intellij.psi.impl.PsiDocumentManagerBase$1.run(PsiDocumentManagerBase.java:325)
at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommit(PsiDocumentManagerBase.java:329)
at com.intellij.psi.impl.DocumentCommitThread.lambda$createFinishCommitInEDTRunnable$5(DocumentCommitThread.java:488)
at com.intellij.psi.impl.DocumentCommitThread.commitSynchronously(DocumentCommitThread.java:363)
at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$doCommit$2(PsiDocumentManagerBase.java:458)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1055)
at com.intellij.psi.impl.PsiDocumentManagerBase.doCommit(PsiDocumentManagerBase.java:466)
at com.intellij.psi.impl.PsiDocumentManagerBase.commitDocument(PsiDocumentManagerBase.java:305)
at com.intellij.psi.impl.source.codeStyle.lineIndent.FormatterBasedLineIndentProvider.getLineIndent(FormatterBasedLineIndentProvider.java:39)
at com.intellij.psi.impl.source.codeStyle.CodeStyleFacadeImpl.getLineIndent(CodeStyleFacadeImpl.java:71)
at com.intellij.codeInsight.editorActions.EnterHandler.adjustLineIndentNoCommit(EnterHandler.java:303)
at com.intellij.codeInsight.editorActions.EnterHandler$DoEnterAction.run(EnterHandler.java:424)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteActionInner(EnterHandler.java:155)
at com.intellij.codeInsight.editorActions.EnterHandler.lambda$executeWriteAction$0(EnterHandler.java:66)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$disablePostprocessFormattingInside$1(PostprocessReformattingAspect.java:96)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:104)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:95)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:65)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1055)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:64)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:219)
at com.intellij.codeInsight.template.impl.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:49)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1055)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:64)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$null$2(EditorActionHandler.java:209)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:103)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$3(EditorActionHandler.java:208)
at com.intellij.openapi.editor.impl.CaretModelImpl.lambda$runForEachCaret$3(CaretModelImpl.java:354)
at com.intellij.openapi.editor.impl.CaretModelImpl.doWithCaretMerging(CaretModelImpl.java:453)
at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:346)
at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:336)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:206)
at com.jetbrains.cidr.lang.editor.OCSmartCompletionInPlaceholderEnterHandler.executeWriteAction(OCSmartCompletionInPlaceholderEnterHandler.java:83)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1055)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:64)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:216)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:103)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:215)
at com.intellij.openapi.editor.actionSystem.EditorAction.lambda$actionPerformed$0(EditorAction.java:102)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:111)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:86)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:261)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:278)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:625)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$2(IdeKeyEventDispatcher.java:674)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:673)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:518)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:473)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:223)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:681)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:375)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

【问题讨论】:

【参考方案1】:

请检查这是否适合您。

解决方法 1:尝试移动 [ classpath 'com.squareup.sqldelight:gradle-plugin:1.2.0' ] 在依赖项中您的 android 依赖项上方的顶部。

解决方法 2:(如果上述方法不起作用)

1.将所有生成的接口复制到你的常规包中 2.将 compile "com.squareup.sqldelight:runtime:$sqlDelightVer" 添加到您的常规依赖项中,以便映射器等也在那里。

【讨论】:

以上是关于SQLDelight 插件错误的主要内容,如果未能解决你的问题,请参考以下文章

无法解析 com.squareup.sqldelight:native-driver:1.3.0

与 Room 相比,SQLDelight 性能较慢

SQLDelight 关系

如何在 KMM 上为 SQLDelight 编写单元测试

SqlDelight/SQLite 没有正确执行连接?

如何更改 SQLDelight 中表的主键?