Android Studio发布library到jCenter(问题集合)

烦心简单的事情折腾一天了,现在将碰到的问题集中写下,方便以后查询
试过两种方法

下面说下碰到的问题


1.Error:Execution failed for task ‘:viewpagerutilslib-v1:bintrayUpload’.> Could not create package> ‘xxxxx/maven/xxxxxxxxx’: HTTP/1.1 401 Unauthorized

401 这个错误很明显是认证错误,可能是你的用户名或者API key错了


2.Error:Execution failed for task ‘:viewpagerutilslib-v1:bintrayUpload’.> Could not create package> ‘xxxxxx/maven/xxxxx’: HTTP/1.1 404 Not Found

这个404问题比较坑爹,卡在这里绝大部分时间首先你在上传library到bintray之前,你需要先在bintrary new一个仓库名称和type都应该是maven
这里写图片描述
其次:新建maven项目后从网址能看到你的用户名,比如我的https://bintray.com/huyuxin95/maven,
与userOrg = ‘huyuxin95’对应,但是userOrg不一定与登录用户名-PbintrayUser=*一样!)
这里写图片描述


3.androidstudio mavenAndroidJavadocs FAILED GBK编码不可映射

这是因为你的注释有中文,在项目的build.gradle中添加:

 allprojects {
    tasks.withType(Javadoc) {
        options{
            encoding "UTF-8"
            charSet 'UTF-8'
            links "http://docs.oracle.com/javase/7/docs/api"
        }
    }
}

4.批处理macOS与windows的区别
macos:

 ./gradlew clean build bintrayUpload 
 -PbintrayUser=hyman 
 -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxx 
 -PdryRun=false

windows

gradlew.bat clean build bintrayUpload 
 -PbintrayUser=huyuxin 
 -PbintrayKey=32d8bc328c5131d7c76f5205333f2df5d2744632
 -PdryRun=false

如果你的windows还没安装gradlew.bat,他会帮你先下载,大概70M,但是如果网络差你可以将提示的下载地址复制到浏览器或者迅雷用第三方下载工具下载,这样快点,手动下载完复制到C:\Users\username\.gradle\wrapper\dists\gradle-指定版本-all\随机字符的文件夹下重启AS,再运行

gradlew.bat clean build bintrayUpload 
 -PbintrayUser=huyuxin 
 -PbintrayKey=32d8bc328c5131d7c76f5205333f2df5d2744632
 -PdryRun=false

他解压好压缩包就可以了


5.提示这样的错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lint'.
> Lint found errors in the project; aborting build.

Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
    lintOptions {
        abortOnError false
    }
}

直接在library的build.gradle的android下 添加即可
如:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    lintOptions{
        abortOnError false
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值