现在的位置: 首页 > 综合 > 正文

chromium 之python编译:文件R不存在问题

2017年01月18日 ⁄ 综合 ⁄ 共 1283字 ⁄ 字号 评论关闭

本人时间有限,潦草记录几个问题

在做chromium的开发工作中,会遇到一些问题,现在简单记录两个:

1. 文件R.java找不到

    由于自己所需,在chromium的content下做些开发,更改content_shell.gypi文件之后,运行android_gyp没问题,但是编译的时候会出现此问题。

   问题定位:

    在文件content_shell.gypi中有target:

        {
          'target_name': 'content_shell_java',
          'type': 'none',
          'dependencies': [
            'content.gyp:content_java',
          ],
          'variables': {
            'java_in_dir': '../content/shell/android/java',
            'has_java_resources': 1,
            'R_package': 'org.chromium.content_shell',
            'R_package_relpath': 'org/chromium/content_shell',
          },
          'includes': [ '../build/java.gypi' ],
        },

      看看是否是找不到R文件的java类,是否不在'org.chromium.content_shell目录下,而目录'org.chromium.content_shell又是在/content/shell/android/java'下,请自己看好这个路径的对应关系哦,以及在代码中具体的层次关系。

2. 仿照cotnent_shell.gypi写了一个gypi文件后,更新android_gyp后,执行ninja命令,提示找不到ninja.build中没有此target。

   注:每次更改gyp或者gypi文件都要执行命令android_gyp

   首先,要看看是否自己写的gypi文件,添加到gyp体系中。out/Debug或者out/Release下的文件,在执行android_gyp后,会生成一些,包括文键ninja.build.

   但是自己写的gypi文件没有加入gyp体系中,android_gyp命令的执行,就不会在生成的文件ninja.build中有相应的对应对象。

   在tag28中,编写的文件要加入content.gyp中,在tag34,编写的文件要加入content_shell_and_test.gyp文件中,具体位置及添加的方式,可以仿照该文件中content_shell.gypi的写法。

如果还是不行,则将out/Debug 或者out/Release目录下内容删掉,再执行android_gyp命令之后,out目录下能否找到ninja.build,如果找不到则就是gypi文件写的有问题咯

具体删除那个目录,则看是编译的debug版(删out/Debug 下)还是Release版本(删out/Release)

抱歉!评论已关闭.