Fixed
Status Update
Comments
am...@google.com <am...@google.com> #2
Actually, there was an error message, but "run" just didn't work, although I could autocomplete to the value "merge-only-attributes", so it seemed legitimate.
jg...@google.com <jg...@google.com>
jg...@google.com <jg...@google.com>
an...@google.com <an...@google.com> #3
do you have an example project that reproduces the error ?
an...@google.com <an...@google.com> #4
Here is a project where you can see the error.
The problem is that, while there is no error indicated on the project, when I try to run using the IDE run button (or ctrl-r), nothing happens (gradle build doesn't even start) and I see this exception on "IDE Fatal Errors" (the red exclamation mark icon in the bottom right in the status bar):
java.lang.IllegalArgumentException: No enum constant com.android.manifmerger.NodeOperationType.MERGE-ONLY-ATTRIBUTES
at java.lang.Enum.valueOf(Enum.java:238)
at com.android.manifmerger.NodeOperationType.valueOf(NodeOperationType.java:34)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:108)
at com.android.manifmerger.XmlElement.initMergeableChildren(XmlElement.java:893)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:170)
at com.android.manifmerger.XmlElement.initMergeableChildren(XmlElement.java:893)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:170)
at com.android.manifmerger.XmlDocument.getRootNode(XmlDocument.java:247)
at com.android.manifmerger.PlaceholderHandler.visit(PlaceholderHandler.java:82)
at com.android.manifmerger.ManifestMerger2.performPlaceHolderSubstitution(ManifestMerger2.java:1068)
at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:1027)
at com.android.manifmerger.ManifestMerger2.merge(ManifestMerger2.java:139)
at com.android.manifmerger.ManifestMerger2.access$600(ManifestMerger2.java:61)
at com.android.manifmerger.ManifestMerger2$Invoker.merge(ManifestMerger2.java:1737)
at com.android.tools.idea.model.ManifestInfo.getMergedManifest(ManifestInfo.java:254)
at com.android.tools.idea.model.ManifestInfo$ManifestFile.parseManifest(ManifestInfo.java:314)
at com.android.tools.idea.model.ManifestInfo$ManifestFile.refresh(ManifestInfo.java:379)
at com.android.tools.idea.model.MergedManifest.syncWithReadPermission(MergedManifest.java:410)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:925)
at com.android.tools.idea.model.MergedManifest.sync(MergedManifest.java:372)
at com.android.tools.idea.model.MergedManifest.getActivities(MergedManifest.java:550)
at com.android.tools.idea.run.activity.DefaultActivityLocator.lambda$computeDefaultActivity$0(DefaultActivityLocator.java:84)
at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:79)
at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:110)
at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:79)
at com.android.tools.idea.run.activity.DefaultActivityLocator.computeDefaultActivity(DefaultActivityLocator.java:83)
at com.android.tools.idea.run.activity.DefaultActivityLocator.validate(DefaultActivityLocator.java:70)
at com.android.tools.idea.run.editor.DefaultActivityLaunch$State.checkConfiguration(DefaultActivityLaunch.java:49)
at com.android.tools.idea.run.AndroidAppRunConfigurationBase.checkConfiguration(AndroidAppRunConfigurationBase.java:113)
at com.android.tools.idea.run.AndroidRunConfigurationBase.validate(AndroidRunConfigurationBase.java:190)
at com.android.tools.idea.run.AndroidRunConfigurationBase.checkConfiguration(AndroidRunConfigurationBase.java:123)
at com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl.checkSettings(RunnerAndConfigurationSettingsImpl.kt:321)
at com.intellij.execution.impl.RunManagerImpl$Companion.canRunConfiguration(RunManagerImpl.kt:67)
at com.intellij.execution.impl.RunManagerImpl$Companion.canRunConfiguration(RunManagerImpl.kt:61)
at com.intellij.execution.impl.RunManagerImpl.canRunConfiguration(RunManagerImpl.kt)
at com.intellij.execution.ProgramRunnerUtil.executeConfigurationAsync(ProgramRunnerUtil.java:65)
at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:43)
at com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:94)
at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:43)
at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:423)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:405)
at com.intellij.util.Alarm$Request.access$700(Alarm.java:330)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:371)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:758)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
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)
But you don't even need my sample project for this. I just created a new project with a basic activity, ran it once to make sure it works then added this attribute to the main activity
in the AndroidManifest.xml:
tools:node="merge-only-attributes"
To be extra clear, this is the main activity node on the manifest that causes the error:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
tools:node="merge-only-attributes">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Removing the "merge-only-attributes" flag makes the error go away. In my original problem, I traded it for "<intent-filter tools:node="removeAll"/>" inside the activity node.
My problem with this is that the IDE even allows me to autocomplete the "merge-only-attributes" flag. If it no longer exists, then it should be removed from the IDE.
The problem is that, while there is no error indicated on the project, when I try to run using the IDE run button (or ctrl-r), nothing happens (gradle build doesn't even start) and I see this exception on "IDE Fatal Errors" (the red exclamation mark icon in the bottom right in the status bar):
java.lang.IllegalArgumentException: No enum constant com.android.manifmerger.NodeOperationType.MERGE-ONLY-ATTRIBUTES
at java.lang.Enum.valueOf(Enum.java:238)
at com.android.manifmerger.NodeOperationType.valueOf(NodeOperationType.java:34)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:108)
at com.android.manifmerger.XmlElement.initMergeableChildren(XmlElement.java:893)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:170)
at com.android.manifmerger.XmlElement.initMergeableChildren(XmlElement.java:893)
at com.android.manifmerger.XmlElement.<init>(XmlElement.java:170)
at com.android.manifmerger.XmlDocument.getRootNode(XmlDocument.java:247)
at com.android.manifmerger.PlaceholderHandler.visit(PlaceholderHandler.java:82)
at com.android.manifmerger.ManifestMerger2.performPlaceHolderSubstitution(ManifestMerger2.java:1068)
at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:1027)
at com.android.manifmerger.ManifestMerger2.merge(ManifestMerger2.java:139)
at com.android.manifmerger.ManifestMerger2.access$600(ManifestMerger2.java:61)
at com.android.manifmerger.ManifestMerger2$Invoker.merge(ManifestMerger2.java:1737)
at com.android.tools.idea.model.ManifestInfo.getMergedManifest(ManifestInfo.java:254)
at com.android.tools.idea.model.ManifestInfo$ManifestFile.parseManifest(ManifestInfo.java:314)
at com.android.tools.idea.model.ManifestInfo$ManifestFile.refresh(ManifestInfo.java:379)
at com.android.tools.idea.model.MergedManifest.syncWithReadPermission(MergedManifest.java:410)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:925)
at com.android.tools.idea.model.MergedManifest.sync(MergedManifest.java:372)
at com.android.tools.idea.model.MergedManifest.getActivities(MergedManifest.java:550)
at com.android.tools.idea.run.activity.DefaultActivityLocator.lambda$computeDefaultActivity$0(DefaultActivityLocator.java:84)
at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:79)
at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:110)
at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:79)
at com.android.tools.idea.run.activity.DefaultActivityLocator.computeDefaultActivity(DefaultActivityLocator.java:83)
at com.android.tools.idea.run.activity.DefaultActivityLocator.validate(DefaultActivityLocator.java:70)
at com.android.tools.idea.run.editor.DefaultActivityLaunch$State.checkConfiguration(DefaultActivityLaunch.java:49)
at com.android.tools.idea.run.AndroidAppRunConfigurationBase.checkConfiguration(AndroidAppRunConfigurationBase.java:113)
at com.android.tools.idea.run.AndroidRunConfigurationBase.validate(AndroidRunConfigurationBase.java:190)
at com.android.tools.idea.run.AndroidRunConfigurationBase.checkConfiguration(AndroidRunConfigurationBase.java:123)
at com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl.checkSettings(RunnerAndConfigurationSettingsImpl.kt:321)
at com.intellij.execution.impl.RunManagerImpl$Companion.canRunConfiguration(RunManagerImpl.kt:67)
at com.intellij.execution.impl.RunManagerImpl$Companion.canRunConfiguration(RunManagerImpl.kt:61)
at com.intellij.execution.impl.RunManagerImpl.canRunConfiguration(RunManagerImpl.kt)
at com.intellij.execution.ProgramRunnerUtil.executeConfigurationAsync(ProgramRunnerUtil.java:65)
at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:43)
at com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:94)
at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:43)
at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:423)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:405)
at com.intellij.util.Alarm$Request.access$700(Alarm.java:330)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:371)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:758)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
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)
But you don't even need my sample project for this. I just created a new project with a basic activity, ran it once to make sure it works then added this attribute to the main activity
in the AndroidManifest.xml:
tools:node="merge-only-attributes"
To be extra clear, this is the main activity node on the manifest that causes the error:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
tools:node="merge-only-attributes">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Removing the "merge-only-attributes" flag makes the error go away. In my original problem, I traded it for "<intent-filter tools:node="removeAll"/>" inside the activity node.
My problem with this is that the IDE even allows me to autocomplete the "merge-only-attributes" flag. If it no longer exists, then it should be removed from the IDE.
Description
Hello, I found that calling
context.getSystemService(Context.VIBRATOR_SERVICE)
leads to a crash if run in the IDE preview, even in interactive preview, which is quite annoying when you have haptics linked to touch interaction for example.Why isn't that implemented as a no-op in the IDE, or implemented through speakers, or as a visual indicator to see when the vibrator is asked to be running?
All the details are below, have a good one!
Louis CAD
Jetpack Compose version: 1.2.1
Jetpack Compose component(s) used: IDE preview
Android Studio Build:
Kotlin version: 1.7.10
Steps to Reproduce or Code Sample to Reproduce:
LocalContext.current.getSystemService(Context.VIBRATOR_SERVICE)
in a@Composable
functionStack trace (if applicable):