【已解决】Android的ADT v22.3.0中不能自动生成R.java

【问题】

之前用Android的ADT编译android项目,都是正常的,都可以正常在

gen下面生成对应的R.java。

最近遇到问题是:

在更新了ADT到最新的22版本后:

【记录】在Eclipse 4.3.1 Kepler中安装最新版的ADT 22.3.0

结果却遇到问题了:

在gen目录下,不能生成对应的R.java了。

(另外一个BuildConfig.java是可以正常生成的)

gen folder not auto generate r.java file

 

【解决过程】

1.去参考:

Java/Eclipse – No more R file ever

去装SDK Build-tools v19的:

android sdk build tools revision 19 size 19.7MB

choose package to install for revision 19 android sdk build tools

装好了19版本的:

revision 19 android sdk build tools has installed

结果还是没生成R.java:

still not gen r.java file

2.再去把

18.1.1

18.1

18.0.1

的SDK Build-tools,也装上:

install old 18 18.1 18.0.1 resision build tools

安装好后:

old 3 three revision sdk build tools has installed

重启ADT和Eclipse看看,结果重新Build还是不行。

3.去看了看项目的属性中的

本身是已经选中了:

Android Private Libraries

了:

Android Private Libraries has selected under order and export

 

4.但是可以再去选择对应的

Android 4.2.2

also select android 2.2 to see result

再去Build看看

还是不行。

5.再去安装Android 4.4的东西:

try to install android 4.4 api 19 all stuff

安装好了:

has installed android 4.4 api 19 modules

结果还是不行。

6.再去参考:

Android ADT version 22, R.java files not generated

先建立:

ANDROID_SDK==D:\Program Files (x86)\Android\android-studio\sdk

再去把对应的路径:

%ANDROID_SDK%\tools;%ANDROID_SDK%\platform-tools;%ANDROID_SDK%\build-tools;

加到PATH中。

确定cmd中可以找到:

C:\Users\CLi>echo %PATH%
D:\tmp\dev_install_root\Python27_x64;D:\tmp\dev_install_root\Python27_x64\Lib\site-packages\PyQt4;D:\tmp\dev_install_root\Perl64\site\bin;D:\tmp\dev_install_root\Perl64\bin;C:\Program Files\Common Fil
es\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C
:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\tmp\WordPress\mysql\mysql-5.5.18
\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64\ext;D:\tmp\WordPress\D
evRoot\Python27;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.7.0_11\bin;/home/CLi/develop/docbook/tools/fop\lib;D:\tmp\tmp
_dev_root\cgwin\home\CLi\develop\docbook\tools\fop;D:\DevInstallRoot\FF\DD_IDE_1.1.2\TOK\BIN;D:\DevInstallRoot\FF\DD_IDE_1.2.0\TOK\BIN;D:\DevRoot\EmbeddedDevelop\trunk\Research\CLI\FF\FBK\develop\tool
s\develop-tools;D:\tmp\WordPress\DevRoot\Python27\Scripts;D:\tmp\dev_install_root\PostgreSQL\8.3\bin;D:\tmp\dev_install_root\ant\apache-ant-1.8.4\bin;C:\Program Files\nodejs\;C:\Program Files\Microsof
t\Web Platform Installer\;D:\DevRoot\xxxxxx\ANTLR\batchFile;C:\Program Files (x86)\QuickTime\QTSystem\;D:\tmp\tmp_dev_root\android\adt-bundle-windows\sdk\platfor
m-tools;D:\tmp\dev_install_root\Tesseract-OCR;D:\tmp\dev_install_root\jython2.5.3\bin;d:\devinstallroot\gnuarm\bin;D:\tmp\dev_install_root\HTML Help Workshop;C:\Program Files\TortoiseSVN\bin;D:\tmp\de
v_install_root\Go\bin;D:\tmp\tmp_dev_root\go\bin;D:\Program Files (x86)\Android\android-studio\sdk\tools;D:\Program Files (x86)\Android\android-studio\sdk\platform-tools;D:\Program Files (x86)\Android
\android-studio\sdk\build-tools;

但是结果:

问题依旧。

7.参考:

新建Android工程没有自动生成R.JAVA,应该先升级下ADT

去试试Fix Project Properties

try android tools fix project properties

结果问题依旧。

8.参考:

新建Android工程没有自动生成R.JAVA,应该先升级下ADT

android helloword 小错误 R.java 文件没有产生

说是platform-tools下的aapt

结果自己这里是:

android-studio中是:

sdk的路径是:

D:\Program Files (x86)\Android\android-studio\sdk

但是:

D:\Program Files (x86)\Android\android-studio\sdk\platform-tools

下面没有aapt:

under android-studio sdk platform-tools no aapt

而是在:

D:\Program Files (x86)\Android\android-studio\sdk\build-tools

下面的,不同的版本中,才有:

D:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2\aapt.exe

D:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.0.0\aapt.exe

android studio sdk build tools contain many versions

build tools android 4.2.2 contains aapt exe

所以:

去尝试把对应的

D:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2\aapt.exe

也加到PATH中:

%ANDROID_SDK%\tools;%ANDROID_SDK%\platform-tools;%ANDROID_SDK%\build-tools;%ANDROID_SDK%\platform-tools\android-4.2.2;%ANDROID_SDK%\platform-tools\19.0.0;

结果打印出来的PATH还是有问题:

C:\Users\CLi>echo %PATH%
D:\tmp\dev_install_root\Python27_x64;D:\tmp\dev_install_root\Python27_x64\Lib\site-packages\PyQt4;D:\tmp\dev_install_root\Perl64\site\bin;D:\tmp\dev_install_root\Perl64\bin;C:\Program Files\Common Fil
es\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C
:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\tmp\WordPress\mysql\mysql-5.5.18
\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64\ext;D:\tmp\WordPress\D
evRoot\Python27;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.7.0_11\bin;/home/CLi/develop/docbook/tools/fop\lib;D:\tmp\tmp
_dev_root\cgwin\home\CLi\develop\docbook\tools\fop;D:\DevInstallRoot\FF\DD_IDE_1.1.2\TOK\BIN;D:\DevInstallRoot\FF\DD_IDE_1.2.0\TOK\BIN;D:\DevRoot\EmbeddedDevelop\trunk\Research\CLI\FF\FBK\develop\tool
s\develop-tools;D:\tmp\WordPress\DevRoot\Python27\Scripts;D:\tmp\dev_install_root\PostgreSQL\8.3\bin;D:\tmp\dev_install_root\ant\apache-ant-1.8.4\bin;C:\Program Files\nodejs\;C:\Program Files\Microsof
t\Web Platform Installer\;D:\DevRoot\xxxxx\ANTLR\batchFile;C:\Program Files (x86)\QuickTime\QTSystem\;D:\tmp\tmp_dev_root\android\adt-bundle-windows\sdk\platfor
m-tools;D:\tmp\dev_install_root\Tesseract-OCR;D:\tmp\dev_install_root\jython2.5.3\bin;d:\devinstallroot\gnuarm\bin;D:\tmp\dev_install_root\HTML Help Workshop;C:\Program Files\TortoiseSVN\bin;D:\tmp\de
v_install_root\Go\bin;D:\tmp\tmp_dev_root\go\bin;D:\Program Files (x86)\Android\android-studio\sdk\tools;D:\Program Files (x86)\Android\android-studio\sdk\platform-tools;D:\Program Files (x86)\Android
\android-studio\sdk\build-tools;D:\Program File

还是不包含对应的platform-tools

9.貌似是PATH的内容太长了?超过PATH值的长度限制了?

把原先的PATH:

D:\tmp\dev_install_root\Python27_x64;D:\tmp\dev_install_root\Python27_x64\Lib\site-packages\PyQt4;D:\tmp\dev_install_root\Perl64\site\bin;D:\tmp\dev_install_root\Perl64\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\tmp\WordPress\mysql\mysql-5.5.18\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64\ext;D:\tmp\WordPress\DevRoot\Python27;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Windows Live\Shared;%JAVA_HOME%\bin;%FOP_HOME%\lib;D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\fop;D:\DevInstallRoot\FF\DD_IDE_1.1.2\TOK\BIN;D:\DevInstallRoot\FF\DD_IDE_1.2.0\TOK\BIN;D:\DevRoot\EmbeddedDevelop\trunk\Research\CLI\FF\FBK\develop\tools\develop-tools;D:\tmp\WordPress\DevRoot\Python27\Scripts;D:\tmp\dev_install_root\PostgreSQL\8.3\bin;%ANT_HOME%\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;D:\DevRoot\xxxxx\ANTLR\batchFile;C:\Program Files (x86)\QuickTime\QTSystem\;D:\tmp\tmp_dev_root\android\adt-bundle-windows\sdk\platform-tools;D:\tmp\dev_install_root\Tesseract-OCR;%JYTHON_HOME%\bin;d:\devinstallroot\gnuarm\bin;D:\tmp\dev_install_root\HTML Help Workshop;C:\Program Files\TortoiseSVN\bin;D:\tmp\dev_install_root\Go\bin;D:\tmp\tmp_dev_root\go\bin;%ANDROID_SDK%\tools;%ANDROID_SDK%\platform-tools;%ANDROID_SDK%\build-tools;%ANDROID_SDK%\platform-tools\android-4.2.2;%ANDROID_SDK%\platform-tools\19.0.0;

 

改为:

D:\tmp\dev_install_root\Python27_x64;D:\tmp\dev_install_root\Python27_x64\Lib\site-packages\PyQt4;D:\tmp\dev_install_root\Perl64\site\bin;D:\tmp\dev_install_root\Perl64\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\tmp\WordPress\mysql\mysql-5.5.18\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64\ext;D:\tmp\WordPress\DevRoot\Python27;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Windows Live\Shared;%JAVA_HOME%\bin;%FOP_HOME%\lib;D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\fop;D:\DevInstallRoot\FF\DD_IDE_1.1.2\TOK\BIN;D:\DevInstallRoot\FF\DD_IDE_1.2.0\TOK\BIN;D:\DevRoot\EmbeddedDevelop\trunk\Research\CLI\FF\FBK\develop\tools\develop-tools;D:\tmp\WordPress\DevRoot\Python27\Scripts;D:\tmp\dev_install_root\PostgreSQL\8.3\bin;%ANT_HOME%\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;D:\DevRoot\xxxxx\ANTLR\batchFile;C:\Program Files (x86)\QuickTime\QTSystem\;D:\DevRoot\android\adt-bundle-windows\sdk\platform-tools;D:\tmp\dev_install_root\Tesseract-OCR;%JYTHON_HOME%\bin;d:\devinstallroot\gnuarm\bin;D:\tmp\dev_install_root\HTML Help Workshop;C:\Program Files\TortoiseSVN\bin;D:\tmp\dev_install_root\Go\bin;D:\tmp\tmp_dev_root\go\bin;%ANDROID_SDK%\tools;%ANDROID_SDK%\platform-tools;%ANDROID_SDK%\build-tools;%ANDROID_SDK%\platform-tools\android-4.2.2;%ANDROID_SDK%\platform-tools\19.0.0;

可以echo出来地址了:

C:\Users\CLi>echo %PATH%
D:\Program Files (x86)\Android\android-studio\sdk\tools;D:\Program Files (x86)\Android\android-studio\sdk\platform-tools;D:\Program Files (x86)\Android\android-studio\sdk\build-tools;D:\Program Files
(x86)\Android\android-studio\sdk\platform-tools\android-4.2.2;D:\Program Files (x86)\Android\android-studio\sdk\platform-tools\19.0.0;D:\tmp\dev_install_root\Python27_x64;D:\tmp\dev_install_root\Pytho
n27_x64\Lib\site-packages\PyQt4;D:\tmp\dev_install_root\Perl64\site\bin;D:\tmp\dev_install_root\Perl64\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Fil
es\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Prog
ram Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\tmp\WordPress\mysql\mysql-5.5.18\MySQL\MySQL Server 5.5\bin;D:\tmp\WordPress\DevRoot\MySQL\MySQL S
erver 5.5\bin;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64;D:\tmp\WordPress\DevRoot\php-5.3.6-Win32-VC9-x64\ext;D:\tmp\WordPress\DevRoot\Python27;C:\Program Files (x86)\Common Files\Acronis\SnapAP
I\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.7.0_11\bin;/home/CLi/develop/docbook/tools/fop\lib;D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\fop;D:\DevInstallRo
ot\FF\DD_IDE_1.1.2\TOK\BIN;D:\DevInstallRoot\FF\DD_IDE_1.2.0\TOK\BIN;D:\DevRoot\EmbeddedDevelop\trunk\Research\CLI\FF\FBK\develop\tools\develop-tools;D:\tmp\WordPress\DevRoot\Python27\Scripts;D:\tmp\d
ev_install_root\PostgreSQL\8.3\bin;D:\tmp\dev_install_root\ant\apache-ant-1.8.4\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;D:\DevRoot\xxxx\ANTLR\batchFile;C:\Program Files (x86)\QuickTime\QTSystem\;D:\DevRoot\android\adt-bundle-windows\sdk\platform-tools;D:\tmp\dev_install_root\Tesseract-OCR;D:\tmp\dev_install_root\jytho
n2.5.3\bin;d:\devinstallroot\gnuarm\bin;D:\tmp\

然后再去试试,还是不行。

10.去打开编译输出详细信息:

android build build output change normal to verbose

然后重新编译,log为:

[2013-11-15 12:57:52 - yyyy] Removing generated java classes.
[2013-11-15 12:58:04 - yyyy] Using default Build Tools revision 19.0.0
[2013-11-15 12:58:04 - yyyy] Refreshing resource folders.
[2013-11-15 12:58:04 - yyyy] Using default Build Tools revision 19.0.0
[2013-11-15 12:58:04 - yyyy] Starting full Pre Compiler.
[2013-11-15 12:58:04 - yyyy] Removing generated java classes.
[2013-11-15 12:58:04 - yyyy] Generating BuildConfig.java...
[2013-11-15 12:58:04 - yyyy] Preparing generated java files for update/creation.
[2013-11-15 12:58:04 - yyyy] D:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.0.0\aapt.exe package -m -v -J D:\DevRoot\xxxxxxxxxxxxx\gen -M D:\DevRoot\xxxxxxxxxxxxx\AndroidManifest.xml -S D:\DevRoot\xxxxxxxxxxxxx\res -I D:\Program Files (x86)\Android\android-studio\sdk\platforms\android-17\android.jar 
[2013-11-15 12:58:04 - yyyy] Configurations:
[2013-11-15 12:58:04 - yyyy]  (default)
[2013-11-15 12:58:04 - yyyy]  v11
[2013-11-15 12:58:04 - yyyy]  v14
[2013-11-15 12:58:04 - yyyy]  hdpi
[2013-11-15 12:58:04 - yyyy]  mdpi
[2013-11-15 12:58:04 - yyyy]  xhdpi
[2013-11-15 12:58:04 - yyyy]  xxhdpi
[2013-11-15 12:58:04 - yyyy]  large
[2013-11-15 12:58:04 - yyyy]  sw600dp
[2013-11-15 12:58:04 - yyyy]  zh
[2013-11-15 12:58:04 - yyyy] 
[2013-11-15 12:58:04 - yyyy] Files:
[2013-11-15 12:58:04 - yyyy]   anim\fadein.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadein.xml
[2013-11-15 12:58:04 - yyyy]   anim\fadeout.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadeout.xml
[2013-11-15 12:58:04 - yyyy]   anim\push_left_in.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_in.xml
[2013-11-15 12:58:04 - yyyy]   anim\push_left_out.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_out.xml
[2013-11-15 12:58:04 - yyyy]   anim\push_right_in.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_in.xml
[2013-11-15 12:58:04 - yyyy]   anim\push_right_out.xml
[2013-11-15 12:58:04 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_out.xml
[2013-11-15 12:58:04 - yyyy]   anim\rotation.xml
......
......
......
......
[2013-11-15 12:58:04 - yyyy]     (new resource id usbserial from D:\DevRoot\xxxxxxxxxxxxx\res\xml\usbserial.xml)
[2013-11-15 12:58:04 - yyyy]     (new resource id catalog_item_text_color from D:\DevRoot\xxxxxxxxxxxxx\res\color\catalog_item_text_color.xml)
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:31: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:35: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:40: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:45: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:50: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:54: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:59: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:65: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:70: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:74: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy]     (new resource id edit_text_holo from D:\DevRoot\xxxxxxxxxxxxx\res\color\edit_text_holo.xml)
[2013-11-15 12:58:04 - yyyy]     (new resource id common_status_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\common_status_view_menu.xml)
[2013-11-15 12:58:04 - yyyy]     (new resource id field_save_status_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\field_save_status_view_menu.xml)
[2013-11-15 12:58:04 - yyyy]     (new resource id field_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\field_view_menu.xml)
[2013-11-15 12:58:04 - yyyy]     (new resource id file_item from D:\DevRoot\xxxxxxxxxxxxx\res\menu\file_item.xml)
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:79: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:84: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:99: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:103: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:108: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:112: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:117: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:121: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:126: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_device_information.xml:130: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:32: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:36: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:42: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:46: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:75: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:79: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:85: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldLabel').
[2013-11-15 12:58:04 - yyyy] D:\DevRoot\xxxxxxxxxxxxx\res\layout\fragment_process_variable.xml:89: error: Error: No resource found that matches the given name (at 'style' with value '@style/fieldValueLabel').
[2013-11-15 12:58:04 - yyyy] 'aapt' error. Pre Compiler Build aborted.
[2013-11-15 12:58:06 - yyyy] Starting full Package build.
[2013-11-15 12:58:06 - yyyy] Using default Build Tools revision 19.0.0

如图:

xml file error no resource found while android adt build project

可以看出,对应的是aapt出错了。

好像是xml出错,则就没有对应的R.java生成。

然后后来是:

改正了xml文件的错误

然后再去clean后再重新build,结果可以正常生成R.java了:

如图:

after resole xml error then normally gen r.java file this is log

对应编译的log为:

[2013-11-15 13:02:32 - yyyy] Removing generated java classes.
[2013-11-15 13:02:40 - yyyy] Using default Build Tools revision 19.0.0
[2013-11-15 13:02:40 - yyyy] Refreshing resource folders.
[2013-11-15 13:02:40 - yyyy] Using default Build Tools revision 19.0.0
[2013-11-15 13:02:40 - yyyy] Starting full Pre Compiler.
[2013-11-15 13:02:40 - yyyy] Removing generated java classes.
[2013-11-15 13:02:40 - yyyy] Generating BuildConfig.java...
[2013-11-15 13:02:40 - yyyy] Preparing generated java files for update/creation.
[2013-11-15 13:02:40 - yyyy] D:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.0.0\aapt.exe package -m -v -J D:\DevRoot\xxxxxxxxxxxxx\gen -M D:\DevRoot\xxxxxxxxxxxxx\AndroidManifest.xml -S D:\DevRoot\xxxxxxxxxxxxx\res -I D:\Program Files (x86)\Android\android-studio\sdk\platforms\android-17\android.jar 
[2013-11-15 13:02:40 - yyyy] Configurations:
[2013-11-15 13:02:40 - yyyy]  (default)
[2013-11-15 13:02:40 - yyyy]  v11
[2013-11-15 13:02:40 - yyyy]  v14
[2013-11-15 13:02:40 - yyyy]  hdpi
[2013-11-15 13:02:40 - yyyy]  mdpi
[2013-11-15 13:02:40 - yyyy]  xhdpi
[2013-11-15 13:02:40 - yyyy]  xxhdpi
[2013-11-15 13:02:40 - yyyy]  large
[2013-11-15 13:02:40 - yyyy]  sw600dp
[2013-11-15 13:02:40 - yyyy]  zh
[2013-11-15 13:02:40 - yyyy] 
[2013-11-15 13:02:40 - yyyy] Files:
[2013-11-15 13:02:40 - yyyy]   anim\fadein.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadein.xml
[2013-11-15 13:02:40 - yyyy]   anim\fadeout.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadeout.xml
[2013-11-15 13:02:40 - yyyy]   anim\push_left_in.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_in.xml
[2013-11-15 13:02:40 - yyyy]   anim\push_left_out.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_out.xml
[2013-11-15 13:02:40 - yyyy]   anim\push_right_in.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_in.xml
[2013-11-15 13:02:40 - yyyy]   anim\push_right_out.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_out.xml
[2013-11-15 13:02:40 - yyyy]   anim\rotation.xml
[2013-11-15 13:02:40 - yyyy]     Src: () D:\DevRoot\xxxxxxxxxxxxx\res\anim\rotation.xml
[2013-11-15 13:02:40 - yyyy]   color\catalog_item_text_color.xml
[2013-11-15 13:02:40 - yyyy]     Src: () 
......
......
......
......
[2013-11-15 13:02:40 - yyyy]     (new resource id list_group_item from D:\DevRoot\xxxxxxxxxxxxx\res\layout\list_group_item.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id list_key_value from D:\DevRoot\xxxxxxxxxxxxx\res\layout\list_key_value.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id progress_bar from D:\DevRoot\xxxxxxxxxxxxx\res\layout\progress_bar.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id tab_indicator from D:\DevRoot\xxxxxxxxxxxxx\res\layout\tab_indicator.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id treeviewitem from D:\DevRoot\xxxxxxxxxxxxx\res\layout\treeviewitem.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id fadein from D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadein.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id fadeout from D:\DevRoot\xxxxxxxxxxxxx\res\anim\fadeout.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id push_left_in from D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_in.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id push_left_out from D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_left_out.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id push_right_in from D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_in.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id push_right_out from D:\DevRoot\xxxxxxxxxxxxx\res\anim\push_right_out.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id rotation from D:\DevRoot\xxxxxxxxxxxxx\res\anim\rotation.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id hartcompany_v5 from D:\DevRoot\xxxxxxxxxxxxx\res\xml\hartcompany_v5.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id hartcompany_v7 from D:\DevRoot\xxxxxxxxxxxxx\res\xml\hartcompany_v7.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id setting from D:\DevRoot\xxxxxxxxxxxxx\res\xml\setting.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id usbserial from D:\DevRoot\xxxxxxxxxxxxx\res\xml\usbserial.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id catalog_item_text_color from D:\DevRoot\xxxxxxxxxxxxx\res\color\catalog_item_text_color.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id edit_text_holo from D:\DevRoot\xxxxxxxxxxxxx\res\color\edit_text_holo.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id common_status_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\common_status_view_menu.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id field_save_status_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\field_save_status_view_menu.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id field_view_menu from D:\DevRoot\xxxxxxxxxxxxx\res\menu\field_view_menu.xml)
[2013-11-15 13:02:40 - yyyy]     (new resource id file_item from D:\DevRoot\xxxxxxxxxxxxx\res\menu\file_item.xml)
[2013-11-15 13:02:40 - yyyy]   Writing symbols for class R.
[2013-11-15 13:02:41 - yyyy] Starting full Package build.
[2013-11-15 13:02:41 - yyyy] Using default Build Tools revision 19.0.0
[2013-11-15 13:02:41 - yyyy] Skipping over Post Compiler.

至此:

终于解决了,不能生成R.java的事情。

 

【总结】

主要原因是:

此处的res/layout下面有xml文件中包含错误

而导致ADT无法调用aapt正常的生成所需要的R.java

解决办法是:

解决掉xml文件的错误,即可,正常生成对应的R.java



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量