环境准备
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
找一个台新机器,因为要升级内核文件,我升级,中文全部识别不了,全是乱码,没解决
yum
-
y install gcc gcc
-
c
+
+
autoconf automake
yum install glibc
-
common
解决libc.so.
6
: version `GLIBC_2.
14
'
not
found问题
http:
/
/
stuart.blog.
51cto
.com
/
728677
/
1840205
http:
/
/
blog.csdn.net
/
cpplang
/
article
/
details
/
8462768
curl http:
/
/
dl.google.com
/
android
/
ndk
/
android
-
ndk
-
r10e
-
linux
-
x86_64.
bin
-
-
output
/
usr
/
java
/
android
-
ndk
-
r10e
-
linux
-
x86_64.
bin
android
list
sdk
-
u
http:
/
/
www.cnblogs.com
/
sink_cup
/
archive
/
2011
/
12
/
01
/
2230344.html
Ubuntu
15.10
x64 安装 Android SDK
/
usr
/
java
/
androidsdk
/
tools
/
bin
sdkmanager
"build-tools;25.0.0"
/
usr
/
java
/
androidsdk
/
platform
-
tools
buildscript {
repositories {
jcenter()
}
dependencies {
classpath
'com.android.tools.build:gradle:2.3.1'
}
}
http:
/
/
blog.csdn.net
/
CheNorton
/
article
/
details
/
50345039
工作环境搭建(
9
)
-
CentOS7命令行安装Android NDK
http:
/
/
blog.csdn.net
/
CheNorton
/
article
/
details
/
50353036
工作环境搭建(
8
)
-
CentOS7命令行安装Android SDK
http:
/
/
blog.csdn.net
/
chenorton
/
article
/
details
/
50345039
centos7中安装Android SDK的方法步骤
http:
/
/
www.jb51.net
/
article
/
119183.htm
cat
/
etc
/
profile
export JAVA_HOME
=
/
usr
/
java
/
jdk
export JRE_HOME
=
/
usr
/
java
/
jdk
/
jre
exportCLASSPATH
=
.:$JAVA_HOME
/
lib
/
dt.jar:$JAVA_HOME
/
lib
/
tools.jar:$JRE_HOME
/
lib
export PATH
=
$JAVA_HOME
/
bin
:$PATH
export ANDROID_SDK_HOME
=
/
usr
/
java
/
android
-
sdk
-
linux
export ANDROID_HOME
=
/
usr
/
java
/
android
-
sdk
-
linux
export GRADLE_HOME
=
/
usr
/
java
/
gradle
-
3.3
export MAVEN_HOME
=
/
usr
/
java
/
apache
-
maven
-
3.3
.
9
export PATH
=
/
usr
/
local
/
apr
/
bin
:$MAVEN_HOME
/
bin
:$PATH
export PATH
=
/
usr
/
java
/
androidsdk
/
platform
-
tools:
/
usr
/
java
/
androidsdk
/
tools
/
bin
:$ANDROID_HOME:$ANDROID_HOME
/
tools:$ANDROID_HOME
/
platform
-
tools:$ANDROID_SDK_HOME
/
tools:$ANDROID_SDK_HOME
/
platform
-
tools:$GRADLE_HOME
/
bin
:
/
usr
/
local
/
apr
/
bin
:
/
usr
/
java
/
apache
-
maven
-
3.3
.
9
/
bin
:
/
root
/
shell:
/
usr
/
java
/
jdk
/
bin
:
/
usr
/
lib64
/
qt
-
3.3
/
bin
:
/
usr
/
local
/
sbin:
/
usr
/
local
/
bin
:
/
sbin:
/
bin
:
/
usr
/
sbin:
/
usr
/
bin
:
/
root
/
bin
:
/
usr
/
local
/
git
/
bin
export MAVEN_OPTS
=
"-Xms1024m -Xmx1024m"
|
具体步骤
1.libc.so.6: version `GLIBC_2.14' not found
2.先安装androidsdk,生成证书文件夹
3.android list sdk -u 更新
./android update sdk -u -t add-on,extra,platform,platform-tool,tool
包
http://services.gradle.org/distributions/ gradle安装包
注意
兼容性 yum whatprovides libstdc++.so.6
编译步骤
1.bulid.g 修改
2.linc 文件
3.命令
4.移动依赖的文件
5.壳 setting
gradle clean build
gradle assemble_devdebug
主工程
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
}
模块
PullToRefresh
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
buildscript {
repositories {
jcenter()
}
dependencies {
classpath
'com.android.tools.build:gradle:2.3.1'
}
}
def
getCurrentTime() {
return
new Date().
format
(
"yyyyMMddHHmm"
, TimeZone.getTimeZone(
"UTC"
))
}
apply
plugin:
'com.android.application'
android {
lintOptions {
abortOnError false
}
android.applicationVariants.
all
{ variant
-
>
variant.outputs.each { output
-
>
def
outputFile
=
output.outputFile
if
(outputFile !
=
null && outputFile.name.endsWith(
'.apk'
)) {
def
buildType
=
variant.buildType.name
def
fileName
=
"andpl_V${defaultConfig.versionName}_${getCurrentTime()}${variant.productFlavors[0].name}.apk"
output.outputFile
=
new
File
(outputFile.parent, fileName)
}
}
}
|
3.jenkins配置
clean assemble${PRODUCT_FLAVOR}${BUILD_TYPE} --stacktrace --debug
BUILD_TYPE Release
PRODUCT_FLAVOR Beta
CODE_BRANCH develop
VERSION 1.0.0
编译指定productFlavor及buildType的apk
$gradle assemble[productFlavor][buildType]
需要动态写入的参数有versionName、打包时间戳、是来自Jenkjins运行还是我们本地打包的标识符
把这三个参数与其在本地的默认值定义在gradle.properties中,然后在build.gradle变能引用。
本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1965268,如需转载请自行联系原作者