Here is the strange behavior. I have this layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/AppTheme.FragmentBackground.XXXX.Parent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/appbar"
layout="@layout/layout_appbar" />
<LinearLayout
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_height="wrap_content">
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
So far, everything seems perfect. Although, if I replace the LinearLayout with a NestedScrollView, all of a sudden, the suggestions just do not work! If I remove the nested scrollview, everything seems to work again. Here are my gradle dependencies:
implementation 'androidx.appcompat:appcompat:1.6.0' implementation 'androidx.appcompat:appcompat-resources:1.6.0' implementation 'androidx.core:core:1.9.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.navigation:navigation-fragment:2.5.3' implementation 'androidx.navigation:navigation-ui:2.5.3' implementation 'com.android.support:support-annotations:28.0.0' implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.5' implementation 'com.google.android.gms:play-services-location:21.0.1' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'androidx.preference:preference:1.2.0' implementation 'org.apache.commons:commons-io:1.3.2' implementation 'androidx.fragment:fragment:1.5.5' // Forecast Charts implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' // maps v2 implementation 'androidx.asynclayoutinflater:asynclayoutinflater:1.0.0' implementation 'com.google.android.gms:play-services-maps:18.1.0' implementation 'com.google.maps.android:android-maps-utils:2.4.0' // needed for timestamps manip implementation 'net.danlew:android.joda:2.11.2' implementation "androidx.camera:camera-camera2:1.2.1" implementation "androidx.camera:camera-lifecycle:1.2.1" implementation "androidx.camera:camera-view:1.2.1" implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0' //implementation 'com.google.mlkit:barcode-scanning:17.0.2' implementation 'androidx.window:window:1.0.0'
while my gradle is gradle-7.5-bin.zip and my plugins are
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
version '2.0.1' apply false }
Also a popup of broken IDE is appeared and here is the log:
java.lang.NullPointerException
at org.jetbrains.android.dom.AttributeProcessingUtil.registerAttributesForClassAndSuperclasses(AttributeProcessingUtil.java:315)
at org.jetbrains.android.dom.AttributeProcessingUtil.processLayoutAttributes(AttributeProcessingUtil.java:604)
at org.jetbrains.android.dom.AttributeProcessingUtil.processAttributes(AttributeProcessingUtil.java:681)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:56)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:28)
at com.intellij.util.xml.reflect.DomExtenderEP.extend(DomExtenderEP.java:91)
at com.intellij.util.xml.impl.DynamicGenericInfo.runDomExtenders(DynamicGenericInfo.java:124)
at com.intellij.util.xml.impl.DynamicGenericInfo.lambda$checkInitialized$0(DynamicGenericInfo.java:55)
at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
at com.intellij.util.xml.impl.DynamicGenericInfo.checkInitialized(DynamicGenericInfo.java:54)
at com.intellij.util.xml.impl.DynamicGenericInfo.getAttributeChildrenDescriptions(DynamicGenericInfo.java:231)
at com.intellij.xml.impl.dom.AbstractDomChildrenDescriptor.getAttributeDescriptor(AbstractDomChildrenDescriptor.java:184)
at com.intellij.xml.impl.dom.AbstractDomChildrenDescriptor.getAttributeDescriptor(AbstractDomChildrenDescriptor.java:195)
at org.jetbrains.android.dom.layout.LayoutElementDescriptor.getAttributeDescriptor(LayoutElementDescriptors.kt:124)
at com.intellij.psi.impl.source.xml.XmlAttributeDelegate.getDescriptionImpl(XmlAttributeDelegate.java:68)
at com.intellij.psi.impl.source.xml.XmlAttributeDelegate.lambda$getDescriptor$0(XmlAttributeDelegate.java:55)
at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:39)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:227)
at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:121)
at com.intellij.psi.impl.source.xml.XmlAttributeDelegate.getDescriptor(XmlAttributeDelegate.java:53)
at com.intellij.psi.impl.source.xml.XmlAttributeImpl.getDescriptor(XmlAttributeImpl.java:191)
at com.intellij.psi.impl.source.xml.XmlAttributeReference$1.compute(XmlAttributeReference.java:23)
at com.intellij.psi.impl.source.xml.XmlAttributeReference$1.compute(XmlAttributeReference.java:20)
at com.intellij.openapi.util.NullableLazyValue.getValue(NullableLazyValue.java:20)
at com.intellij.psi.impl.source.xml.XmlAttributeReference.getDescriptor(XmlAttributeReference.java:110)
at com.intellij.psi.impl.source.xml.XmlAttributeReference.resolve(XmlAttributeReference.java:50)
at com.intellij.codeInsight.TargetElementUtilBase.getReferencedElement(TargetElementUtilBase.java:177)
at com.intellij.codeInsight.TargetElementUtilBase.doGetReferenceOrReferencedElement(TargetElementUtilBase.java:165)
at com.intellij.codeInsight.TargetElementUtilBase.getReferenceOrReferencedElement(TargetElementUtilBase.java:210)
at com.intellij.codeInsight.TargetElementUtilBase.getReferencedElement(TargetElementUtilBase.java:254)
at com.intellij.codeInsight.TargetElementUtilBase.doFindTargetElement(TargetElementUtilBase.java:233)
at com.intellij.codeInsight.TargetElementUtilBase.findTargetElement(TargetElementUtilBase.java:298)
at com.intellij.codeInsight.TargetElementUtil.findTargetElement(TargetElementUtil.java:147)
at com.jetbrains.cidr.lang.psi.impl.OCTargetElementUtil.findTargetElement(OCTargetElementUtil.java:47)
at com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider.getPsiElementIn(TextEditorPsiDataProvider.java:226)
at com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider.getSlowData(TextEditorPsiDataProvider.java:139)
at com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider.lambda$getData$0(TextEditorPsiDataProvider.java:93)
at com.intellij.ide.impl.DataManagerImpl.getSlowData(DataManagerImpl.java:153)
at com.intellij.ide.impl.DataManagerImpl.lambda$getDataRule$2(DataManagerImpl.java:121)
at com.intellij.ide.impl.DataManagerImpl.lambda$getDataRule$4(DataManagerImpl.java:126)
at com.intellij.ide.impl.DataManagerImpl.getDataFromProvider(DataManagerImpl.java:77)
at com.intellij.openapi.actionSystem.impl.PreCachedDataContext.getData(PreCachedDataContext.java:182)
at com.intellij.openapi.actionSystem.impl.PreCachedDataContext$InjectedDataContext.getData(PreCachedDataContext.java:327)
at com.intellij.openapi.actionSystem.DataKey.getData(DataKey.java:63)
at org.jetbrains.android.quickDefinitions.AndroidImplementationViewSessionFactory.createSession(AndroidImplementationViewSession.kt:55)
at com.intellij.codeInsight.hint.actions.ShowRelatedElementsActionBase.performForContext(ShowRelatedElementsActionBase.java:86)
at com.intellij.codeInsight.hint.actions.ShowRelatedElementsActionBase.actionPerformed(ShowRelatedElementsActionBase.java:63)
at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:65)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:579)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:704)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$11(IdeKeyEventDispatcher.java:704)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:256)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:701)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:645)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:590)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:473)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:462)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:227)
at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:804)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:740)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
2
Answers
Use Clean Project and Rebuild Project. And Sync Project with Gradle files and download the latest version of Android Studio and then it will suggest.
Sometimes, by default, Android Studio does not show the suggestion.