Android Studio之Project Structure打开后显示异常踩坑记

最近把AS升级到3.4.2版本后,发现项目通过 File -> Project Structure 后打开的Project Structure窗口无法显示项目的配置信息(这个问题在AS旧的版本,3.4之前没出现),如下图:


20190801-153003.png

点击AS右下角的感叹号图标:


20190801-154327.png

打开 IDE Fatal Errors 窗口


20190801-153031.png

发现有报错信息,如下:

cannot create configurable component

java.lang.IllegalStateException: Duplicate key 1.1.3
    at com.android.tools.idea.gradle.dsl.model.ext.GradlePropertyModelImpl.lambda$getMap$2(GradlePropertyModelImpl.java:151)
    at java.util.HashMap.merge(HashMap.java:1253)
    at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1376)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.android.tools.idea.gradle.dsl.model.ext.GradlePropertyModelImpl.getMap(GradlePropertyModelImpl.java:150)
    at com.android.tools.idea.gradle.dsl.model.ext.GradlePropertyModelImpl.extractValue(GradlePropertyModelImpl.java:534)
    at com.android.tools.idea.gradle.dsl.model.ext.GradlePropertyModelImpl.getValue(GradlePropertyModelImpl.java:104)
    at com.android.tools.idea.gradle.dsl.model.ext.GradlePropertyModelImpl.toMap(GradlePropertyModelImpl.java:472)
    at com.android.tools.idea.gradle.structure.model.PsVariable$MapVariableEntries.getKeys(PsVariable.kt:209)
    at com.android.tools.idea.gradle.structure.model.PsVariable$MapVariableEntries.getKeys(PsVariable.kt:203)
    at com.android.tools.idea.gradle.structure.model.android.PsCollectionBase.refresh(PsCollectionBase.kt:43)
    at com.android.tools.idea.gradle.structure.model.PsVariable.init(PsVariable.kt:43)
    at com.android.tools.idea.gradle.structure.model.PsVariables.update(PsVariables.kt:41)
    at com.android.tools.idea.gradle.structure.model.PsVariables.update(PsVariables.kt:23)
    at com.android.tools.idea.gradle.structure.model.android.PsCollectionBase$refresh$2.accept(PsCollectionBase.kt:44)
    at com.android.tools.idea.gradle.structure.model.android.PsCollectionBase$refresh$2.accept(PsCollectionBase.kt:23)
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
    at com.android.tools.idea.gradle.structure.model.android.PsCollectionBase.refresh(PsCollectionBase.kt:44)
    at com.android.tools.idea.gradle.structure.model.PsVariables.<init>(PsVariables.kt:30)
    at com.android.tools.idea.gradle.structure.model.PsProjectImpl.<init>(PsProjectImpl.kt:65)
    at com.android.tools.idea.gradle.structure.configurables.GradleAndroidConfigurableContributor.getConfigurables(GradleAndroidConfigurableContributor.kt:31)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable$addConfigurables$configurables$1.invoke(ProjectStructureConfigurable.kt:330)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable$addConfigurables$configurables$1.invoke(ProjectStructureConfigurable.kt:81)
    at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:279)
    at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:267)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.addConfigurables(ProjectStructureConfigurable.kt:521)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.initSidePanel(ProjectStructureConfigurable.kt:320)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.createComponent(ProjectStructureConfigurable.kt:216)
    at com.intellij.openapi.options.ex.ConfigurableCardPanel.lambda$createConfigurableComponent$0(ConfigurableCardPanel.java:73)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:973)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
    at com.intellij.openapi.options.ex.ConfigurableCardPanel.createConfigurableComponent(ConfigurableCardPanel.java:69)
    at com.intellij.openapi.options.ex.ConfigurableCardPanel.create(ConfigurableCardPanel.java:55)
    at com.intellij.openapi.options.newEditor.ConfigurableEditor$1.create(ConfigurableEditor.java:57)
    at com.intellij.openapi.options.newEditor.ConfigurableEditor$1.create(ConfigurableEditor.java:54)
    at com.intellij.ui.CardLayoutPanel.createValue(CardLayoutPanel.java:88)
    at com.intellij.ui.CardLayoutPanel.select(CardLayoutPanel.java:116)
    at com.intellij.ui.CardLayoutPanel.select(CardLayoutPanel.java:101)
    at com.intellij.openapi.options.newEditor.ConfigurableEditor.init(ConfigurableEditor.java:106)
    at com.intellij.openapi.options.newEditor.SingleSettingEditor.<init>(SingleSettingEditor.java:29)
    at com.intellij.openapi.options.newEditor.SettingsDialog.<init>(SettingsDialog.java:41)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable$showDialog$dialog$1.<init>(ProjectStructureConfigurable.kt:286)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.showDialog(ProjectStructureConfigurable.kt:286)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.showPlace(ProjectStructureConfigurable.kt:267)
    at com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.show(ProjectStructureConfigurable.kt:283)
    at com.android.tools.idea.gradle.actions.AndroidShowStructureSettingsAction.showAndroidProjectStructure(AndroidShowStructureSettingsAction.java:62)
    at com.android.tools.idea.gradle.actions.AndroidShowStructureSettingsAction.actionPerformed(AndroidShowStructureSettingsAction.java:53)
    at com.intellij.openapi.actionSystem.impl.ChameleonAction.actionPerformed(ChameleonAction.java:58)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:258)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:275)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:287)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:277)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:308)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:193)
    at java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:389)
    at java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:357)
    at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:355)
    at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:343)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:767)
    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.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:755)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:704)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
    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)

java.lang.IllegalStateException: Duplicate key 1.1.3,意思存在重复的key 1.13,然后就在项目中全局搜索,发现在项目中的build.gradle文件中存在重复的key 1.13,两个一样的
“ badgeview : '1.1.3', ”


20190801-15531.png

解决方法:去掉一个“ badgeview : '1.1.3', ”就可以了。
以上仅仅是我项目的Project Structure显示异常的解决过程,希望对遇到此类问题的你有所帮助。当然也许你遇到的Project Structure显示异常的情况和我不同,如果你解决了,诚谢你分享和告知,以便帮助到需要帮助的人。😊😊😊

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,590评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 86,808评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,151评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,779评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,773评论 5 367
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,656评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,022评论 3 398
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,678评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 41,038评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,659评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,756评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,411评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,005评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,973评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,053评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,495评论 2 343