安装Ubuntu12.0.4LTS/14.045 LTS 编译Android6.0/7.0环境

 sudo apt-get update
 sudo apt-get upgrade


7.0要安装 openJDK8 并切换

sudo add-apt-repository ppa:openjdk-r/ppa

sudo apt-get update

sudo apt-get install openjdk-8-jdk

编译Android6.0切换OpenJDK8到OpenJDK 这个三个都要切不然 编译报错

sudo update-alternatives --config java

sudo update-alternatives --config javac

sudo update-alternatives --config javadoc


如果要删除

sudo apt-get purge openjdk*


6.0安装openjdk7

 sudo apt-get install openjdk-7-jdk


其他需要提前安装的

 sudo apt-get -y install python-yaml    //(python P 要小写)

 sudo apt-get install curl

sudo apt-get install bison

sudo apt-get  install libxml2-utils

sudo apt-get install ia32-libs

sudo apt-get install p7zip-full

sudo apt-get install openssl 
sudo apt-get install libssl-dev




安装 gnome桌面(非必要)

sudo apt-get install gnome-session-fallback

alt+Tab切换窗口

sudo apt-get install compizconfig-settings-manager

配置:系统工具-首选项-compizConfig ,点击左边窗口管理,把右边Static Application Switcher勾打上



配置andoid  adb 命令

gedit ~/.bashrc

在末尾配置加上 你的Anndroid SDK 路径

export PATH=$PATH:$HOME/bin
export PATH=$PATH:/home/XX/Sofeware/android-sdk-linux/tools
export PATH=$PATH:/home/XXSofeware/android-sdk-linux/platform-tools

然后 source ~/.bashrc



SSH公钥配置到Gerrit服务器


mkdir ~/.ssh

cd .ssh

执行

ssh-keygen

输入自己的姓名  按Enter 

把.pub文件里的内容拷贝到 Gierrit

然后

cd ~/.ssh/

gedit config 

输入


host GerritServer
user XXX
hostname 10.8.10.19
port 29418
identityfile ~/.ssh/XXX

保存


下面是常见错误:


错误:编译6.0时候报

prebuilts/sdk/api/23.txt:52930: error 9: Removed public constructor java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject.AbstractQueuedSynchronizer.ConditionObject()
prebuilts/sdk/api/23.txt:53025: error 9: Removed public constructor java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.ReentrantReadWriteLock.ReadLock(ReentrantReadWriteLock)
prebuilts/sdk/api/23.txt:53035: error 9: Removed public constructor java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock.ReentrantReadWriteLock.WriteLock(ReentrantReadWriteLock)
prebuilts/sdk/api/23.txt:53074: error 9: Removed public constructor java.util.jar.Attributes.Name.Attributes.Name(String)
prebuilts/sdk/api/23.txt:54404: error 9: Removed public constructor javax.crypto.spec.PSource.PSpecified.PSource.PSpecified(byte)

******************************
You have tried to change the API from what has been previously released in
an SDK.  Please fix the errors listed above.
******************************


make: *** [out/target/common/obj/PACKAGING/checksystemapi-last-timestamp] 错误 38

解决方法 make-update-api也不管用

卸载 openjdk 8

sudo apt-get purge  openjdk*

重新安装OpenJDK7

 sudo apt-get install openjdk-7-jdk

可以 解决,但同事的电脑就可以 Openjdk 7 8 共存 ,

后来发现是切换OpenJdk8到OpenJdk 7时候没执行

sudo update-alternatives --config javadoc

所以 从openJDK8到OpenJdk7一点要 三个都 要切;

sudo update-alternatives --config java

sudo update-alternatives --config javac

sudo update-alternatives --config javadoc





错误

ninja: error: 'out/target/common/obj/APPS/amigoframework-res_intermediates/src/R.stamp', needed by 'out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar', missing and no known rule to make it

解决 sudo apt-get -y install python-yaml 



编译7.0时候报

错误:Try increasing heap size with java option '-Xmx<size>'.

解决:编译机硬件内存条太小 我的内存条是8G 扩展到16G

或者治标的方法
1.export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"

2.kill jack 服务

. /prebuilts/sdk/tools/jack-admin kill-server

3.启动jack 服务

. /prebuilts/sdk/tools/jack-admin start-server


错误:ninja: fork: Cannot allocate memory
解决办法与上面的方法一样但是编译到80%时候还会报,解决办法把编译机扩展内存条到16G,如果是16G要关掉虚拟机等占内存的进程,之前是8G的 Android7.0要求很高



编译7.0时候报

FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar  2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"
Jack server already installed in "/home/lixufei/.jack-server"
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/lixufei/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
No Jack server running. Try 'jack-admin start-server'
No Jack server running. Try 'jack-admin start-server'
ninja: build stopped: subcommand failed.







其他一些问题 我没遇到过:

usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1

解决:
  sudo apt-get install libc6-dev-i386 

错误:
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] error 1

解决:
  sudo apt-get install g++-multilib 

错误:
external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

解决:
sudo apt-get install zlib1g-dev


错误:
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

解决:
sudo apt-get install lib32z1-dev


错误:
bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127

解决:
sudo apt-get install bison


错误:
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

解决:
sudo apt-get install flex


错误:
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

解决:
sudo apt-get install lib32ncurses5-dev


错误:

prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main-common.o] Error 1

解决:
sudo apt-get install libx11-dev 

错误:
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'

解决:
sudo apt-get install gperf



ubuntu中在Launcher上添加Android Studio的运行图标

运行命令创建desktop文件:

    sudo gedit /usr/share/applications/android_studio.desktop

打开窗口后输入以下内容,注意Exec和Icon要修改成自己系统下Android Studio的路径。

[Desktop Entry]
Type=Application
Name=Android Studio
Exec="/opt/android-studio/bin/studio.sh" %f
Icon=/opt/android-studio/bin/studio.png
Categories=development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio

 

保存关闭文件,运行以下命令添加执行权限:

sudo chmod +x /usr/share/applications/android_studio.desktop

 

之后,使用命令打开applications文件夹:

sudo nautilus /usr/share/applications

 

找到android_studio.desktop文件,把文件拖动到Launcher条上。




gerrit 帐号 姓名 密码 姓+123 

http://10.8.10.19/gerrit/

redmine 帐号 姓名简称  密码 姓gnredmine

http://10.8.0.20/redmine/

OA

http://hr.gioXX.com/    00500525/99XX36


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值