zoukankan      html  css  js  c++  java
  • jdk/java版本与Android源码编译中的错误

    错误一:javap未指向有效的java版本

    Traceback (most recent call last):
      File "../../base/android/jni_generator/jni_generator.py", line 1065, in <module>
        sys.exit(main(sys.argv))
      File "../../base/android/jni_generator/jni_generator.py", line 1061, in main
        options.optimize_generation)
      File "../../base/android/jni_generator/jni_generator.py", line 996, in GenerateJNIHeader
        jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, namespace)
      File "../../base/android/jni_generator/jni_generator.py", line 507, in CreateFromClass
        stderr=subprocess.PIPE)
      File "/usr/lib/python2.7/subprocess.py", line 709, in __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory
    make: *** [/home/odexcide/android-4./out/target/product/generic/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h] Error 1
    make: *** Waiting for unfinished jobs..

    原因 javap不存在于环境变量中

    使用 sudo update-alternatives --config javap 查看指向,选择合适的版本,如果不存在,则添加javap

    sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 300

    配置 sudo update-alternatives --config javap 注:如果只有一个可选的话,则不会列表,即无需处理

    错误二 Chromium gyp HashSet_jni.h 

    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:10:26: error: extra tokens at end of #ifndef directive [-Werror]
    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:11:26: error: missing whitespace after the macro name [-Werror]
    target thumb C++: content_content_common_gyp <= external/chromium_org/content/common/android/surface_texture_peer.cc
    In file included from external/chromium_org/content/common/android/hash_set.cc:5:0:
    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:24:20: error: expected initializer before '<' token
    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:26:17: error: expected initializer before '<' token
    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected '{' before '<' token
    out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected unqualified-id before '<' token
    external/chromium_org/content/common/android/hash_set.cc:30:1: error: expected '}' at end of input
    cc1plus: all warnings being treated as errors
    make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/content_content_common_gyp_intermediates/content/common/android/hash_set.o] 错误 1
    make: *** 正在等待未完成的任务....

    这可能是由于java版本不符,请安装相应版本的jdk。

    此外, 如果尚未解决,可参考此帖进行修改源码,本人不建议

  • 相关阅读:
    NLPIR的语义分析系统
    [译] 12步轻松搞定python装饰器
    python实现爬取千万淘宝商品的方法_python_脚本之家
    Deep Learning(深度学习)学习笔记整理系列 | @Get社区
    那些年,曾经被我们误读的大数据
    值得关注的10个python语言博客
    淘宝的评论归纳是如何做到的?
    pycharm激活码
    Windows下配置Qt 5.8+opencv 3.1.0开发环境
    Ubuntu安装opencv3.1.0后配置环境变量
  • 原文地址:https://www.cnblogs.com/rainduck/p/3718227.html
Copyright © 2011-2022 走看看