Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library子工程找不到R.java的问题 #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gongziya
Copy link

@gongziya gongziya commented Jan 8, 2021

在library工程中使用x2c时,因为gradle不会在library目录下生成R.java文件,取而代之,有一个类似的文件 R.txt,功能和R.java类似。所以本次提交针对library工程,去寻找R.txt文件,并按照R.txt的内容去解析。以解决library找不到R.java的报错

另外有的版本R.java格式稍有不同,类似下面这样:
public static final class layout {
private layout() {}

    public static final int abc_action_bar_title_item = 0x7f0c0000;

}
所以解析R.java的代码也稍作了修改,遇到private layout() {}和空行就跳过。

@qq8803128
Copy link

在library工程中使用x2c时,因为gradle不会在library目录下生成R.java文件,取而代之,有一个类似的文件 R.txt,功能和R.java类似。所以本次提交针对library工程,去寻找R.txt文件,并按照R.txt的内容去解析。以解决library找不到R.java的报错

另外有的版本R.java格式稍有不同,类似下面这样:
public static final class layout {
private layout() {}

    public static final int abc_action_bar_title_item = 0x7f0c0000;

}
所以解析R.java的代码也稍作了修改,遇到private layout() {}和空行就跳过。

idea 2020版本与高版本gradle-plugin中library的R.txt的id都是0x0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants