博观而约取,厚积而薄发。这篇文章主要讲述安卓工作室 android studio文件和代码模板,以及汉化出错问题相关的知识,希望能为你提供帮助。
安卓工作室 android studio文件和代码模板,以及汉化出错问题
作者:韩梦飞沙
Author:han_meng_fei_sha
邮箱:313134555@qq.com
E-mail: 313134555 @qq.com
文章图片
android studio 汉化后,报错。
文章图片
无法为bundle java util属性资源包找到资源,关键的emmet bem类名称元素分隔符
Can\'t find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
捆bundle
某resource不在此文件中,对应的key为 emmet.bem.class.name.element.separator.label
BEM的意思就是块(block)、元素(element)、修饰符(modifier)
<
form class="search-form">
<
input type="text" class="search-form__username">
<
input type="password" class="search-form__password">
<
button id="J_Submit" class="search-form__submit--active">
<
/button>
<
form>
这里的B,指的是Block,也就是"search-form"
这里的E,指的是Element,也就是跟随在search-form后的"username", "password"和"submit",并且用两个下划线(
__
)表示承接关系这里的M,指的是Modifier,也就是submit后面的"active",用两个连接符表示承接关系(
--
)Emmet 是一个网页前端开发工具。
Espresso 是个编辑器,Sublime Text 就是个编辑器。
==========详细信息:
Can\'t find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
java.util.MissingResourceException: Can\'t find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
at java.util.ResourceBundle.getObject(ResourceBundle.java:450)
at java.util.ResourceBundle.getString(ResourceBundle.java:407)
at com.intellij.application.options.emmet.XmlEmmetConfigurable.$$$setupUI$$$(XmlEmmetConfigurable.java)
at com.intellij.application.options.emmet.XmlEmmetConfigurable.< init> (XmlEmmetConfigurable.java:55)
at com.intellij.codeInsight.template.emmet.generators.XmlZenCodingGeneratorImpl.createConfigurable(XmlZenCodingGeneratorImpl.java:155)
at com.intellij.application.options.emmet.EmmetConfigurableProvider.getAvailableConfigurables(EmmetConfigurableProvider.java:41)
at com.intellij.application.options.emmet.EmmetConfigurableProvider.createConfigurable(EmmetConfigurableProvider.java:31)
at com.intellij.openapi.options.ConfigurableEP$ProviderProducer.createElement(ConfigurableEP.java:326)
at com.intellij.openapi.options.ConfigurableEP.createConfigurable(ConfigurableEP.java:273)
at com.intellij.openapi.options.ex.ConfigurableWrapper.createConfigurable(ConfigurableWrapper.java:54)
at com.intellij.openapi.options.ex.ConfigurableWrapper.getConfigurable(ConfigurableWrapper.java:121)
at com.intellij.openapi.options.ex.ConfigurableWrapper.cast(ConfigurableWrapper.java:102)
at com.intellij.openapi.options.ex.ConfigurableWrapper$CompositeWrapper.getConfigurables(ConfigurableWrapper.java:256)
at com.intellij.openapi.options.newEditor.SettingsTreeView$MyNode.buildChildren(SettingsTreeView.java:473)
at com.intellij.ui.treeStructure.CachingSimpleNode.getChildren(CachingSimpleNode.java:36)
at com.intellij.ui.treeStructure.SimpleTreeStructure.getChildElements(SimpleTreeStructure.java:25)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:67)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:82)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:82)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.rebuild(FilteringTreeStructure.java:62)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.< init> (FilteringTreeStructure.java:54)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.< init> (FilteringTreeStructure.java:45)
at com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder.< init> (FilteringTreeBuilder.java:53)
at com.intellij.openapi.options.newEditor.SettingsTreeView$MyBuilder.< init> (SettingsTreeView.java:804)
at com.intellij.openapi.options.newEditor.SettingsTreeView.< init> (SettingsTreeView.java:207)
at com.intellij.openapi.options.newEditor.SettingsEditor.< init> (SettingsEditor.java:149)
at com.intellij.openapi.options.newEditor.SettingsDialog.< init> (SettingsDialog.java:70)
at com.intellij.ide.actions.ShowSettingsUtilImpl.getDialog(ShowSettingsUtilImpl.java:57)
at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:94)
at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:62)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:197)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:156)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:211)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$2(ActionMenuItem.java:304)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:905)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:284)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.access$300(TransactionGuardImpl.java:40)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:113)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:123)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:109)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:513)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
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:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:795)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
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)
=============
文章图片
文件模板 file Templates
检查描述 inspection Descriptions
打算描述 intention Descriptions
后缀模板 postfix Templates
=======
ResourceBundle类是java提供的一个读取properties文件(配置文件)的一种方法。
文件中以#开头做为注释,下面是我的数据库连接的配置文件
========
#数据库配置信息
DRIVER=com.mysql.jdbc.Driver
URL=jdbc:mysql:
//localhost:3306/test
user=rwuser
password=rwuser
#路径配置信息
path=D:\\\\Java\\\\jdk1.
6
.0_31\\\\bin
========
下面是我使用ResourceBundle类处理:
========package
iceinfo.bat.test;
import
java.util.ResourceBundle;
public
class
TestResourceBundle
{
public
static
void
main(String[]
args)
{
String
fileName=
"config"
;
//
config.properties它跟普通java类的命名规则完全一样:
//
-
文件名和包名是区分大小写
//
-
扩展名
.properties
省略
//
-
资源文件必须位于classpath下,如果在某个包下成在定义fileName时要加上包的名称,且包名区分大小写
//
如果是Web项目,不写包路径可以,此时将资源文件放在WEB-INF\\classes\\目录下就可以。
ResourceBundle
paramBundle
=
ResourceBundle.getBundle(fileName);
System.out.println(paramBundle.getString(
"DRIVER"
));
System.out.println(paramBundle.getString(
"URL"
));
System.out.println(paramBundle.getString(
"user"
));
System.out.println(paramBundle.getString(
"PASSWORD"
));
//这儿是区分大小写的
System.out.println(paramBundle.getString(
"path"
));
}
}
==========注:如果fileName的名字中大小写或没有加入properies文件所在的包名那么会报 Exception in thread "main" java.util.MissingResourceException: Can\'t find bundle for base name config1, locale zh_CN 如果在获取properties文件中的key对应的value值时如果没有区分小写会报 Exception in thread "main" java.util.MissingResourceException: Can\'t find resource for bundle java.util.PropertyResourceBundle, key PASSWORD ======= emmet.bem.class.name.element.separator.label 如何在很多文件中 查找 点击组织-文件夹选项
文章图片
点到搜索选项卡,选中下面的始终搜索文件名和内容,并点击确定
文章图片
如何搜索文件内容在哪个文件中_百度经验
文章图片
searchableOptions.xml
然而,这种搜索,对 txt这样的后缀有效。 对其他的 比如.properties 后缀。是无效的。 .properties这种文件里的内容是不会被搜索的。要想搜索,就把后缀改成txt。
======
我们发现 汉化的 文件 ActionsBundle.properties 少了很多语句。 所以出现了上面的问题。 对比原来的文件,将必要的语句加上就可以了。
文章图片
【安卓工作室 android studio文件和代码模板,以及汉化出错问题】
推荐阅读
- 安卓工作室 android studio 汉化后,报错。 设置界面打不开。Can't find resource for bundle java.util.PropertyResourceBu
- Android开发中EditText的点击Enter键焦点改变处理(获取焦点和失去焦点交互变化)
- 安卓工作室Android Studio 快捷键
- Ant打包Android代码生成apk文件
- LeetCode - 448. Find All Numbers Disappeared in an Array
- Android Studio配置及使用OpenCV
- DOM内部插入append()与appendTo()
- android当前网络连接类型判断
- Native App,Web App 还是 Hybrid app