加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 如何摆脱警告:使用’$’代替’.’对于Eclipse中的内部

发布时间:2020-12-14 05:30:05 所属栏目:Java 来源:网络整理
导读:我是 Android开发的新手.当我将eclipse和Android SDK更新到最新版本后,我发现了一个警告: Use '$' instead of '.' for inner classes (or use only lowercase letters in package names) AndroidManifest.xml 我在这个link找到了一些信息. "When you refere
我是 Android开发的新手.当我将eclipse和Android SDK更新到最新版本后,我发现了一个警告:
Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)   AndroidManifest.xml

我在这个link找到了一些信息.

"When you reference an inner class in a manifest file,you must use '$' instead of '.' " +
    "as the separator character,e.g. Outer$Inner instead of Outer.Inner.n" +
    "n" +
    "(If you get this warning for a class which is not actually an inner class,it's " +
    "because you are using uppercase characters in your package name,which is not " +
    "conventional.)"

我相信我使用像com.abc.app.Promotion这样的子包名称中的大写字符.

问题是:在manifest.xml中摆脱这个警告的最好办法是什么?它仍然可以建立和运行,但我觉得这么烦人.

我尝试使用refactor来重命名包,并修改了manifest.xml android:name =“com.abc.app.promotion.Promotion”,但是得到了这个错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.app/com.abc.app.TabView}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.abc.app/com.abc.app.promotion.Promotion}; have you declared this activity in your AndroidManifest.xml?

感谢您的帮助!

编辑:
原始manifest.xml

<activity android:name=".Promotion.Promotion" ></activity>

更新了manifest.xml

<activity android:name="promotion.Promotion" ></activity>

解决方法

如果您对于实际上不是内部类的类收到此警告,那是因为您在包名称中使用大写字符,这不是传统的.

我也尝试只改变包名的第一个字母为小写,警告消失了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读