看以往的教材中R.java都是在項目的\app\build\generated\source\r\debug\包名下的
通常AS會自動在項目的R.java中創建代表項目中資源的資源ID,大致格式如下
public final class R
{
public static final class layout
{
public static final int activity_main = 0x7f040017;
}
public static final class mipmap
{
public static final int ic_launcher = 0x7f030000;
}
public static final class string
{
public static final int app_name = 0x7f0b0011;
public static final int hello_world = 0x7f0b0012;
}
}
結果今天在使用AS4.0.1新建Helloworld項目,發現\generated\source目錄下不存在\r\debug\,在文件管理其中搜索有關R的文件發現R.java變為了R.txt
並且R.txt在D:\Android\HelloWorld\app\build\intermediates\runtime_symbol_list\debug目錄下
stackoverflow上面有這樣的操作:
https://stackoverflow.com/questions/28522144/where-is-the-r-java-file-in-android-studio
再右鍵就能show bytecode就能看見了