23

I am using Android Studio Chipmunk | 2021.2.1 build and facing an unusual error with choosing option "Show Diff" from Git section at bottom.

How to reproduce :

  1. Open Android Studio
  2. Find Git option at the bottom
  3. Now choose any branch from the console
  4. Select any commit
  5. Try opening the changed file(by using double-click or right click and choose "Show Diff") to see the difference made in that commit

Error : The file doesn't open.

This issue was not there before updating Android Studio Chipmunk .I can't say if it is related to Android Studio or most probably something on my end is broken, but if you know anything about it, let me know!

Working Alternative : I am able to open it if I choose "Show Diff in a New Tab" by right clicking on the file.

Edit 1: This is the log error I am getting

java.lang.Throwable: Assertion failed
    at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:218)
    at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:227)
    at com.intellij.openapi.fileEditor.impl.text.TextEditorComponent.<init>(TextEditorComponent.java:76)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl$PsiAwareTextEditorComponent.<init>(PsiAwareTextEditorImpl.java:107)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl.createEditorComponent(PsiAwareTextEditorImpl.java:85)
    at com.intellij.openapi.fileEditor.impl.text.TextEditorImpl.<init>(TextEditorImpl.java:52)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl.<init>(PsiAwareTextEditorImpl.java:36)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider.createEditor(PsiAwareTextEditorProvider.java:31)
    at com.android.tools.idea.uibuilder.editor.multirepresentation.sourcecode.SourceCodeEditorProvider.createEditor(SourceCodeEditorProvider.kt:91)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4Edt(FileEditorManagerImpl.java:997)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl4$17(FileEditorManagerImpl.java:969)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.runBulkTabChange(FileEditorManagerImpl.java:1786)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl4$18(FileEditorManagerImpl.java:968)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:438)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:456)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:965)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl2$14(FileEditorManagerImpl.java:891)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:216)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:172)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:162)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:148)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:890)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:764)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:731)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:719)
    at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:132)
    at com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager.openFile(VcsEditorTabFilesManager.kt:75)
    at com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager.openFile(VcsEditorTabFilesManager.kt:60)
    at com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager.showDiffFile(EditorTabDiffPreviewManager.kt:38)
    at com.intellij.openapi.vcs.changes.EditorTabPreview$Companion.openPreview(EditorTabPreview.kt:173)
    at com.intellij.vcs.log.ui.frame.EditorDiffPreview.openPreviewInEditor(VcsLogDiffPreview.kt:136)
    at com.intellij.vcs.log.ui.frame.EditorDiffPreview.setPreviewVisible(VcsLogDiffPreview.kt:125)
    at com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager.showDiffPreview(EditorTabDiffPreviewManager.kt:42)
    at com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase.showDiff(ChangesBrowserBase.java:272)
    at com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase.onDoubleClick(ChangesBrowserBase.java:192)
    at com.intellij.openapi.vcs.changes.ui.ChangesTree.lambda$setDoubleClickAndEnterKeyHandler$3(ChangesTree.java:256)
    at com.intellij.openapi.vcs.changes.ui.ChangesTreeHandlers$createDoubleClickListener$1.onDoubleClick(ChangesTreeHandlers.kt:52)
    at com.intellij.ui.DoubleClickListener.onClick(DoubleClickListener.java:30)
    at com.intellij.ui.ClickListener$1.mouseReleased(ClickListener.java:59)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6652)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
    at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:394)
    at java.desktop/java.awt.Component.processEvent(Component.java:6417)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2784)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:885)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:814)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:751)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:441)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:825)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:440)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:794)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:492)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
oyeraghib
  • 878
  • 3
  • 8
  • 26
  • What do you mean by "try opening the file"? What do you do? – Code-Apprentice May 31 '22 at 03:13
  • Is Android Studio really the problem? Can you open the file in VS Code or some other editor? Trying other ways to do the same thing can often help you narrow down what the problem is. – Code-Apprentice May 31 '22 at 03:14
  • @Code-Apprentice by saying "try opening a file" I meant that when I am opening a file which has been changed due to a commit I can't open this file from the bottom Git option. – oyeraghib May 31 '22 at 16:39
  • I'm asking what actions do you actually do to "open a file"? Just repeating your words doesn't explain what you did. Did you double click on the file name? DId you right click and select Open Source? Either of these could qualify as "open a file", although the first is actually a diff. Or did you do something else? – Code-Apprentice May 31 '22 at 19:52
  • 7
    I spent sometime with it and realized that I am having this issue with just one application. Doing a "double-click" doesn't open the files. And doing right click and choosing "Show Diff" also doesn't open the file. I am able to open the files when I choose "Show DIff in a New Tab". – oyeraghib May 31 '22 at 22:08
  • Double clicking and "Show Diff" both will show the diff between that commit and the previous one. This isn't really "opening the file", which is why I was asking for clarification. I see what you mean now because I'm getting the same behavior in Chipmunk 2021.2.1 Patch 1. – Code-Apprentice Jun 01 '22 at 02:41
  • 2
    Do you also get a bubble that says that Android Studio encountered an error? I have seen it throw "java.lang.Throwable: Assertion failed" multiple times as I've tried this. – Code-Apprentice Jun 01 '22 at 02:43
  • I'm convinced this is a bug. If I press open File -> Settings -> Advanced Settings the scroll down to the "Version Control" section, I see an option "Open Diff as Editor Tab". It was selected, and when I uncheck it and click OK, now double clicking opens an empty window. I think Google has borked this feature from the IntelliJ code base. – Code-Apprentice Jun 01 '22 at 02:48
  • this happened to me too, any solution? – Ade Dyas Jun 03 '22 at 12:00
  • 2
    Same issue. Here's what I did and didn't help: 1) Updating to Android Studio Chipmunk | 2021.2.1 **Patch 1** 2) Reinstalling Android Studio 3) Delete the following folders and reinstall: - ~/Library/Application Support/AndroidStudio - ~/Library/Caches/AndroidStudio - ~/Library/Logs/AndroidStudio - ~/Library/Preferences/AndroidStudio 4) Increase heap size to 2048 MB might save you some time. – themenace Jun 09 '22 at 07:52
  • 1
    Looks like this has been fixed in the latest Chipmunk/Dolphin releases. Official bug tracker report: https://issuetracker.google.com/issues/232045613 – Tim Kist Jun 09 '22 at 09:30
  • Chipmunk Patch 2 has the fix – Tim Kist Jun 09 '22 at 10:15

1 Answers1

2

You can (as workaround) select two any commits in the tree, right-click and "Compare versions". The changes window will opened. Then you will be able open any file-diff by double-click or Ctrl+D.

enter image description here

antaki93
  • 704
  • 7
  • 10
  • Yes, as I mentioned choosing "Show Diff in New Tab" works pretty good. It's just something broken with "Show Diff" feature. I hope they would fix in the next patch. Thanks for the answer anyways. – oyeraghib Jun 25 '22 at 13:35