zoukankan      html  css  js  c++  java
  • Android快速发布项目到jcenter详解

    不管别人的教程多详细,都有他们忽略的坑,所以,都要自己动手。我也是参考了许多许多的博客,弄了一上午加下午十分钟,才搞定。

    参考:
    下面这个是大部分的步骤
    http://blog.csdn.net/zhcswlp0625/article/details/54895584

    下面这个是填坑的:
    http://blog.csdn.net/tmac2000/article/details/53261141

    坑一:
    创建仓库时,如果使用Bintray-release,名字就填成maven,因为他的wiki:repoName: The repository name. Set to ‘maven’ by default.(有错误请指出)
    不然就会报错:
    Bintray- HTTP/1.1 404 Not Found [message:Repo ‘maven’ was not found]

    坑二:gradle版本号要写为:
    classpath ‘com.android.tools.build:gradle:2.1.0’
    因为
    classpath ‘com.android.tools.build:gradle:2.2.0’
    好像会报unsupport * 错误

    我自己的一些配置:
    最外层的grale配置:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
            classpath 'com.novoda:bintray-release:0.3.4'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    要上传的gradle配置:

    apply plugin: 'com.android.library'
    apply plugin: 'com.novoda.bintray-release'//添加
    android {
        compileSdkVersion 23
        buildToolsVersion '23.0.0'
    
        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        lintOptions {
            abortOnError false
        }
    
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.0.0'
        testCompile 'junit:junit:4.12'
    }
    
    publish {
        userOrg = 'coaxinyu'//bintray.com用户名
        groupId = 'com.caoxinyu'//jcenter上的路径
        artifactId = 'coaxinyu'//项目名称
        publishVersion = '1.0.0'//版本号
        desc = 'this is for test'//描述,不重要
        website = 'https://github.com/coaxinyu/tobebetter'//网站,最好有,不重要
    }
    

    然后执行的命令:

    gradlew clean build bintrayUpload  -PbintrayUser=coaxinyu   -PbintrayKey=*****  -PdryRun=false
    

    记住,学东西都要自己动手,别人的教程再详细,在你的电脑上都会有坑。记住了,年轻人,自己动手。

  • 相关阅读:
    POJ 1811 Prime Test 素性测试 分解素因子
    sysbench的安装与使用
    电脑中已有VS2005和VS2010安装.NET3.5失败的解决方案
    I.MX6 show battery states in commandLine
    RPi 2B Raspbian system install
    I.MX6 bq27441 driver porting
    I.MX6 隐藏电池图标
    I.MX6 Power off register hacking
    I.MX6 Goodix GT9xx touchscreen driver porting
    busybox filesystem httpd php-5.5.31 sqlite3 webserver
  • 原文地址:https://www.cnblogs.com/caoxinyu/p/10568627.html
Copyright © 2011-2022 走看看