ubuntu 1604 编译 Android 5.1.1 Tips

请注意,本文编写于 127 天前,最后修改于 127 天前,其中某些信息可能已经过时。

1. error: change the API

****************************
You have tried to change the API from what has been previously approved.

To make these errors go away, you have two choices:
   1) You can add "@hide" javadoc comments to the methods, etc. listed in the
      errors above.

   2) You can update current.txt by executing the following command:
         make update-api

      To submit the revised current.txt to the main Android repository,
      you will need approval.
****************************

这个错误源于aapt的一个解析bug,具体分析可参考:https://plus.google.com/+hashcode0f/posts/URHo3hBmfHY

解决方法:
找到文件 systemcorelibutilsString8.cpp,将第427行的 memcpy 改为

memmove

             next = len;
         }
 
-        memcpy(buf + tail, buf + index + skip, next - index - skip);
+        memmove(buf + tail, buf + index + skip, next - index - skip);
         tail += next - index - skip;
         index = next;
     }

0x02 error: unsupported reloc 43

in file /art/build/Android.common_build.mk, find out:

# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
  # By default, host builds use clang for better warnings.
  ART_HOST_CLANG := true
endif

change to :

# Host.
ART_HOST_CLANG := false
ifeq ($(WITHOUT_HOST_CLANG),false)
  # By default, host builds use clang for better warnings.
  ART_HOST_CLANG := true
endif

If it still not works,try this in your android root path:

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

参考:

  1. Ubuntu 18.04 编译 Android 5.0 注意事项
  2. Building Android from sources: unsupported reloc 43

添加新评论

请不要水评论

已有 2 条评论