Android的工作室:强调了文本中不支持错误 [英] Android Studio: underscores in literals are not supported error

查看:150
本文介绍了Android的工作室:强调了文本中不支持错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在R.java文件中的绘制类的问题。我不得不绘制华电国际,MDPI,xhdpi ......夹在主/ RES,但绘制不见了,所以我用手工创建它。 main.xml中能够找到声明的形象,但在R.java这个code给出了一个错误:

I have a problem with the drawable class in R.java file. I had drawable hdpi, mdpi, xhdpi... folders in main/res, but drawable was missing so i created it by hand. Main.xml is able to find the image declared but this code in R.java gives an error:

    public static final class drawable {
    public static final int 10_device_access_accounts=0x7f020000;
    public static final int 10_device_access_add_alarm=0x7f020001;
    public static final int 10_device_access_alarms=0x7f020002;
    public static final int 10_device_access_battery=0x7f020003;
    public static final int 10_device_access_bightness_low=0x7f020004;
    public static final int 10_device_access_bluetooth=0x7f020005;
    public static final int 10_device_access_bluetooth_connected=0x7f020006;
    public static final int 10_device_access_bluetooth_searching=0x7f020007;
    public static final int 10_device_access_brightness_auto=0x7f020008;
    ...}

在编译给出一个错误:
摇篮:错误:下划线文字中的-source 1.6不支持
(使用-source 7或更高,以使下划线的文字中)

When compiled gives out an error: Gradle: error: underscores in literals are not supported in -source 1.6 (use -source 7 or higher to enable underscores in literals)

我采用了android Studio版本1.0.0.1和JDK版本1.7.0.250,我有PATH变量指向%JAVA_HOME%\\ bin和CLASSPATH指向%JAVA_HOME%\\ lib中

I'm using android studio version 1.0.0.1 and jdk 1.7.0.250 version, i have PATH variable pointing to %JAVA_HOME%\bin and CLASSPATH pointing to %JAVA_HOME%\lib

推荐答案

删除10_在你的文件可以解决此问题的开始。 <一href=\"http://stackoverflow.com/questions/7096892/android-drawable-resource-with-numbers-is-it-possible\">For为什么你不能有一个数字名称的资源的原因,请阅读本。如果论文绘制ressources的图标,可以使用通用命名约定,你可以阅读 ,并以IC_或ic_menu如果这是菜单图标和操作栏图标开始你的图标。

removing the "10_" at the beginning of your files can fix the issue. For the reason why you can't have a resource with a numeric name, read this . If theses drawable ressources are icons, you can use the common naming conventions that you can read here, and begin your icons by "ic_" or "ic_menu" if this is Menu icons and Action Bar icons.

这篇关于Android的工作室:强调了文本中不支持错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆