Ubuntu 16.04 android 5.1编译错误

硬件平台:RK3288

android版本:5.1


1、编译遇到如下错误:

libnativehelper/JniInvocation.cpp:45: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
host C++: libc++ <= external/libcxx/src/algorithm.cpp
host C++: libc++ <= external/libcxx/src/bind.cpp
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1
make: *** 正在等待未完成的任务....

这个问题其实在编译6.0时已经遇到过了,只是版本略有不同,解决办法如下:

cp /usr/bin/ld.gold   /prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld 

参考:http://blog.csdn.net/u014770862/article/details/52624851

2、错误如下:

  File "../base/android/jni_generator/jni_generator.py", line 1527, in 
    sys.exit(main(sys.argv))
  File "../base/android/jni_generator/jni_generator.py", line 1518, in main
    GenerateJNIHeader(input_file, output_file, options)
  File "../base/android/jni_generator/jni_generator.py", line 1401, in GenerateJNIHeader
    jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, options)
  File "../base/android/jni_generator/jni_generator.py", line 652, in CreateFromClass
    jni_from_javap = JNIFromJavaP(stdout.split('\n'), options)
  File "../base/android/jni_generator/jni_generator.py", line 600, in __init__
    signature=JniParams.ParseJavaPSignature(contents[lineno + 1]))]
  File "../base/android/jni_generator/jni_generator.py", line 212, in ParseJavaPSignature
    return '"%s"' % signature_line[signature_line.index(prefix) + len(prefix):]
ValueError: substring not found
external/chromium_org/content/java_set_jni_headers.target.linux-arm.mk:24: recipe for target 'out/target/product/rk3288/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h' failed
make: *** [out/target/product/rk3288/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "../base/android/jni_generator/jni_generator.py", line 1527, in 
    sys.exit(main(sys.argv))
  File "../base/android/jni_generator/jni_generator.py", line 1518, in main
    GenerateJNIHeader(input_file, output_file, options)
  File "../base/android/jni_generator/jni_generator.py", line 1401, in GenerateJNIHeader
    jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, options)
  File "../base/android/jni_generator/jni_generator.py", line 652, in CreateFromClass
    jni_from_javap = JNIFromJavaP(stdout.split('\n'), options)
  File "../base/android/jni_generator/jni_generator.py", line 600, in __init__
    signature=JniParams.ParseJavaPSignature(contents[lineno + 1]))]
  File "../base/android/jni_generator/jni_generator.py", line 212, in ParseJavaPSignature
    return '"%s"' % signature_line[signature_line.index(prefix) + len(prefix):]
ValueError: substring not found
external/chromium_org/content/motionevent_jni_headers.target.linux-arm.mk:24: recipe for target 'out/target/product/rk3288/obj/GYP/shared_intermediates/content/jni/MotionEvent_jni.h' failed
make: *** [out/target/product/rk3288/obj/GYP/shared_intermediates/content/jni/MotionEvent_jni.h] Error 1

这是因为我的电脑同时安装了jdk1.7和jdk1.8,而切换java版本的时候没有切换javap,javap是JDK自带的反汇编器,

使用如下命令切换即可:

sudo update-alternatives --config javap

参考:http://blog.csdn.net/ameyume/article/details/28855723/

你可能感兴趣的:(Android系统)