不管別人的教程多詳細,都有他們忽略的坑,所以,都要自己動手。我也是參考了許多許多的博客,弄了一上午加下午十分鐘,才搞定。
參考: 下面這個是大部分的步驟 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記住,學東西都要自己動手,別人的教程再詳細,在你的電腦上都會有坑。記住了,年輕人,自己動手。
新聞熱點
疑難解答