源码导入android

参考
参考2
1, . setenv
2, lunch (choose 14. full_tiny4412-eng)
3, mmm development/tools/idegen/
4, sh ./development/tools/idegen/idegen.sh
这行命令的意思是生成对应的文件:android.iws, android.ipr, android.iml
生成对应的文件后,打开Android Studio,选择打开一个现有的Android Studio项目,选择Android源码的根目录,导入即可(起作用的是android.irp文件).在配置sdk版本之后就可以查看Android 源码了.

报错:

    Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java (Is a directory)    at java.io.FileInputStream.open(Native Method)    at java.io.FileInputStream.(FileInputStream.java:138)    at java.io.FileReader.(FileReader.java:72)    at Configuration.parsePackageName(Configuration.java:204)    at Configuration.rootOf(Configuration.java:180)    at Configuration.traverse(Configuration.java:140)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.traverse(Configuration.java:167)    at Configuration.(Configuration.java:72)    at Main.main(Main.java:37)      

解决办法是将

./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java修改为:./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j

准备文件:

tar xzf android-5.0.2-fs-20150325.tar.gz
tar xzf linux-3.0.86-20150324.tgz

安装环境(ubuntu 16.04):

sudo ./install-devel-packages.shmake -v / 4.1gcc /g++ -v/5.4arm-linux-gcc -v/java -v /openjdk-7

编译kernel

cd linux-3.0.86cp tiny4412_android_defconfig.configmake zInmage

编译android

cd android-5.0.2. setenvlunchchoose full_tiny4412-engmake -j4

打包

./gen-img.sh# if get err : ./gen-img.sh: line 31: mkimage: command not foundtar xzf uboot_tiny4412-20130729.tgzcd uboot_tiny4412make tiny4412_configmakesudo cp tools/mkimage /usr/bin

碰到的错误:
1, Unable to locate package mingw32
处理:

sudo vim /etc/apt/sources.list//在sources.list末尾添加,保存deb http://us.archive.ubuntu.com/ubuntu trusty main universesudo apt-get updatesudo apt-get install mingw32

2, 编译kernel报错

  HOSTCC  scripts/basic/fixdep  HOSTCC  scripts/kconfig/conf.o  HOSTCC  scripts/kconfig/zconf.tab.o  HOSTLD  scripts/kconfig/confscripts/kconfig/conf --silentoldconfig Kconfig  CHK     include/linux/version.h  CHK     include/generated/utsrelease.hmake[1]: 'include/generated/mach-types.h' is up to date.  CC      kernel/bounds.sarm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory/home/arte/work/driver/tiny4412/source/linux-3.0.86/./Kbuild:35: recipe for target 'kernel/bounds.s' failedmake[1]: *** [kernel/bounds.s] Error 1Makefile:997: recipe for target 'prepare0' failedmake: *** [prepare0] Error 2处理=============================================没有指定arm-linux-gcc版本,需要在.bashrc中将toolschain加入export export PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin/

3, 编译android报错, java版本不对

============================================Checking build tools versions...************************************************************You are attempting to build with the incorrect versionof java. Your version is: openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.16.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode).The required version is: "1.7.x" Please follow the machine setup instructions at    https://source.android.com/source/initializing.html************************************************************build/core/main.mk:167: *** stop。 停止。#### make failed to build some targets (6 seconds) ####

解决:
切换java版本到openjdk7
sudo update-alternatives --config java
如果且不过来 , 检查一下~/.bashrc是不是配置了固定java_home
如果还是不行 , 退出termial 在进, 最后不行就重启.

4, clang问题

clang: error: linker command failed with exit code 1 (use -v to see invocation)build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failedmake: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1

重新make 不加-j参数 .

external/libcxx/include/thread:149: error: unsupported reloc 43clang: error: linker command failed with exit code 1 (use -v to see invocation)build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libc++.so' failedmake: *** [out/host/linux-x86/obj32/lib/libc++.so] Error 1#### make failed to build some targets (04:12 (mm:ss)) ####

从log看都和clang有关,参考
1.修改
cd /art/build/
vim Android.common_build.mk //修改第119行
修改前:

# Host.ART_HOST_CLANG := falseifneq ($(WITHOUT_HOST_CLANG),true)# By default, host builds use clang for better warnings.ART_HOST_CLANG := trueendif修改后:# Host.ART_HOST_CLANG := falseifneq ($(WITHOUT_HOST_CLANG),false)# By default, host builds use clang for better warnings.ART_HOST_CLANG := trueendif

2.修改
经过第一次修改之后发现编译还是报同样的错误,执行下面:
cp /usr/bin/ld.gold /prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
3.修改过上述代码后,最好执行一次make update-api,再make

5, 报错如下


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.


build/core/tasks/apicheck.mk:57: recipe for target ‘out/target/common/obj/PACKAGING/checkapi-current-timestamp’ failed
make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38

解决:参考
make update-api

更多相关文章

  1. Android(安卓)命令行打包和签名
  2. 转载:android 源码 打包成apk的实现
  3. Android下高斯模糊的算法和demo
  4. Android(安卓)ANR 分析流程
  5. Firebase引用版本冲突解决:Android(安卓)dependency 'com.google.
  6. Android(安卓)7.1.1 去除Launcher3的抽屉(2018/12/5)
  7. android 部分兼容性问题总结
  8. 更新进度条
  9. Android使用post方式上传图片到服务器的方法

随机推荐

  1. unity 导出 android安装包配置方案
  2. 彻底解决android surfaceview下触摸和键
  3. Android 学习之简单的底部弹出dialog
  4. android tips—开机引导启动wifi设置
  5. tabHost研究二 ,android应用中,大部分的软
  6. 讲一讲对Activity的了解【Android】
  7. React-Native 报错 Error: EISDIR: illeg
  8. Android 状态栏和应用标题栏颜色保持一致
  9. 微信支付问题
  10. Android的事件响应机制