因为你的 build tool 的版本和 Compile 版本不匹配
错误的原因是因为 之前我把
compileSdkVersion 21
正确的配置方案:
compileSdkVersion 23
buildToolsVersion “23.0.2”
compileSdkVersion 21
compileSdkVersion 23
buildToolsVersion “23.0.2”
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// release版本中设置了开启混淆,并且定义了混淆文件的位置
默认情况下还有一个debug版本,我们也可以添加对debug版本的一些设置buildTypes {
debug {
minifyEnabled false
}
}
// debug版本中关闭混淆
buildTypes {
custom.initWith(buildTypes.debug)
custom {
applicationIdSuffix ".custom"
versionNameSuffix "-custom" }}
// custom使用initWith方法复制debug版本并创建了一个新的构建版本,相当于继承了debug版本
// custom版本中添加applicationId后缀,添加versionName后缀
其他属性的设置可以查看buildType的文档。android {
productFlavors {
free { // 免费版
}
paid { // 付费版
}
wandoujia { // 豌豆荚应用市场渠道包
}
myapp { // 应用宝应用市场渠道包
}
}
}
每一个生产版本都可以设置applicationId、versionCode、versionName等许多属性,具体可以查看productFlavors的文档。dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
testCompile 'junit:junit:4.12'
}
dependencies{
// 依赖某个jar文件
complie files('libs/xxx.jar')
// 依赖libs目录下所有以.jar结尾的文件
complie fileTree(dir: 'libs', include: ['*.jar'])
// 依赖libs目录下除了xxx.jar以外的所有以.jar结尾的文件
complie fileTree(dir: 'libs', exclude: ['xxx.jar'], include: ['*.jar'])
}
dependencies{
// 依赖本地项目工程下的某个module
complie project(:'moduleName')
}
android {
repositories {
flatDir {
dirs 'libs'
}
}
}
dependencies{
// 依赖名字为xxx后缀为aar的文件
compile (name: 'xxx', ext: 'aar')
}
dependencies{
// 格式为:group:name:version
compile 'com.android.support:appcompat-v7:23.3.0'
// 排除某个传递依赖
compile 'com.android.support:appcompat-v7:23.3.0'{
exclude group: 'xxx', module: 'xxx'
}
android {
productFlavors {
baidu { // 百度应用市场
}
lenovo { // 联想应用市场
}
common { // 其他不监管广告市场
}
}
}
将所有广告sdk的jar包统一添加前缀"ad_",在build.gradle中的dependencies下添加dependencies{
// 默认不添加广告sdk
compile fileTree(dir: 'libs', excludes: ['ad_*.jar'], include: ['*.jar'])
// 百度市场添加百度广告sdk
baiduCompile files(libs/ad_baidu_sdk.jar)
// 联想应用市场的包添加联想广告sdk
lenovoCompile files(libs/ad_lenovo_sdk.jar)
// 其他不监管广告应用市场添加通用的广告sdk
commonCompile files(libs/ad_common_sdk.jar)
}
配置完成后运行gradle assembleRelease命令,就会生成各个市场的渠道包,并且含有不用的广告sdk。android {
productFlavors {
baidu { // 百度应用市场
}
lenovo { // 联想应用市场
}
common { // 其他不监管广告市场
}
}
}
在build.gradle中的dependencies下添加dependencies{
// 百度市场添加百度广告sdk
baiduCompile "com.baidu:ad:1.0.0"
// 联想应用市场的包添加联想广告sdk
lenovoCompile "com.lenovo:ad:1.0.0"
// 其他不监管广告应用市场添加通用的广告sdk
commonCompile "com.common:ad:1.0.0"
}
android {
productFlavors {
baidu { // 百度应用市场
}
lenovo { // 联想应用市场
}
huawei { // 华为应用市场
}
}
}
在build.gradle中的dependencies下添加dependencies{
// 默认添加通用广告sdk
compile "com.common:ad:1.0.0"
// 百度市场在默认的compile中去掉通用广告sdk
baiduCompile configurations.compile {
exclude(group: "com.common:ad:1.0.0", module: "ad")
}
// 百度市场添加百度广告sdk
baiduCompile "com.baidu:ad:1.0.0"
// 联想市场在默认的compile中去掉通用广告sdk
baiduCompile configurations.compile {
exclude(group: "com.common:ad:1.0.0", module: "ad")
}
// 联想应用市场的包添加联想广告sdk
lenovoCompile "com.lenovo:ad:1.0.0"
// 华为市场在默认的compile中去掉通用广告sdk
baiduCompile configurations.compile {
exclude(group: "com.common:ad:1.0.0", module: "ad")
}
}
compile 'com.chow.ui:mlw:1.1.2-release'compile 'com.chow.ui:gjb:1.1.2-release'compile 'com.chow.ui:xjlh:1.1.2-release'
mlwCompile 'com.chow.ui:mlw:1.1.2-release'xjlhCompile 'com.chow.ui:gjb:1.1.2-release'gjbCompile 'com.chow.ui:xjlh:1.1.2-release'
git push [远程名] :[分支名]
$ git push origin :serverfix
git push [远程名] [本地分支]:[远程分支]
$ git branch -a
master
remote
tungway
v1.52
* zrong
remotes/origin/master
remotes/origin/tungway
remotes/origin/v1.52
remotes/origin/zrong
$ git push origin --delete <branchName>
git push origin --delete tag <tagname>
git push origin :<branchName>
git tag -d <tagname> git push origin :refs/tags/<tagname>
origin/b1
;origin/b1
远程分支;b1
分支,运行 git branch -a
也不能看出这个branch被删除了,如何处理?$ git remote show origin * remote origin Fetch URL: git@github.com:xxx/xxx.git Push URL: git@github.com:xxx/xxx.git HEAD branch: master Remote branches: master tracked refs/remotes/origin/b1 stale (use 'git remote prune' to remove) Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (up to date)
git remote prune origin
可以将其从本地版本库中去除。git fetch -p
$ git branch -av * devel 752bb84 Merge pull request #158 from Gwill/devel master 53b27b8 Merge pull request #138 from tdlrobin/master zrong 2ae98d8 modify CCFileUtils, export getFileData remotes/origin/HEAD -> origin/master remotes/origin/add_build_script d4a8c4f Merge branch 'master' into add_build_script remotes/origin/devel 752bb84 Merge pull request #158 from Gwill/devel remotes/origin/devel_qt51 62208f1 update .gitignore remotes/origin/master 53b27b8 Merge pull request #138 from tdlrobin/master remotes/origin/zrong 2ae98d8 modify CCFileUtils, export getFileData
$ git push --delete origin devel To git@github.com:zrong/quick-cocos2d-x.git - [deleted] devel
git branch -m devel develop
$ git push origin develop Counting objects: 92, done. Delta compression using up to 4 threads. Compressing objects: 100% (48/48), done. Writing objects: 100% (58/58), 1.38 MiB, done. Total 58 (delta 34), reused 12 (delta 5) To git@github.com:zrong/quick-cocos2d-x.git * [new branch] develop -> develop
$ git push --delete origin devel remote: error: refusing to delete the current branch: refs/heads/devel To git@github.com:zrong/quick-cocos2d-x.git ! [remote rejected] devel (deletion of the current branch prohibited) error: failed to push some refs to 'git@github.com:zrong/quick-cocos2d-x.git'
git push --tags
git fetch origin tag <tagname>
yum update
rpm -qa | grep -E '^open[jre|jdk]|j[re|dk]'
gobject-introspection-1.36.0-4.el7.x86_64 pygobject3-base-3.8.2-4.el7.x86_64
java -version
yum remove java-1.6.0-openjdk yum remove java-1.7.0-openjdk
rpm -ivh jdk-8u25-linux-x64.rpm
Preparing... ################################# [100%] Updating / installing... 1:jdk1.8.0_25-2000:1.8.0_25-fcs ################################# [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... jfxrt.jar...
java -version
java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
export JAVA_HOME=/usr/java/jdk1.8.0_25/ export PATH=$PATH:$JAVA_HOME
echo $JAVA_HOME
/usr/java/jdk1.8.0_25/
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_25/
vi /etc/profile.d/java.sh
#!/bin/bash JAVA_HOME=/usr/java/jdk1.8.0_25/ PATH=$JAVA_HOME/bin:$PATH export PATH JAVA_HOME export CLASSPATH=.
chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_25/jre/bin/java 20000 alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_25/bin/jar 20000 alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_25/bin/javac 20000 alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_25/jre/bin/javaws 20000 alternatives --set java /usr/java/jdk1.8.0_25/jre/bin/java alternatives --set jar /usr/java/jdk1.8.0_25/bin/jar alternatives --set javac /usr/java/jdk1.8.0_25/bin/javac alternatives --set javaws /usr/java/jdk1.8.0_25/jre/bin/javaws
ls -lA /etc/alternatives/
lrwxrwxrwx. 1 root root 29 Dec 2 16:24 jar -> /usr/java/jdk1.8.0_25/bin/jar lrwxrwxrwx. 1 root root 34 Dec 2 16:24 java -> /usr/java/jdk1.8.0_25/jre/bin/java lrwxrwxrwx. 1 root root 31 Dec 2 16:24 javac -> /usr/java/jdk1.8.0_25/bin/javac lrwxrwxrwx. 1 root root 36 Dec 2 16:24 javaws -> /usr/java/jdk1.8.0_25/jre/bin/javaws [...]
java -version
java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)