Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.recwert:UploadManager:1.0.2'
}
dependencies {
implementation("com.github.recwert:UploadManager:1.0.2")
}
<dependency>
<groupId>com.github.recwert</groupId>
<artifactId>UploadManager</artifactId>
<version>1.0.2</version>
</dependency>
libraryDependencies += "com.github.recwert" % "UploadManager" % "1.0.2"
:dependencies [[com.github.recwert/UploadManager "1.0.2"]]
Android upload abstract module
API 11
将Android上的文件上传模块抽象出来,并在接口层提供文件上传的文件命名策略,文件压缩策略等
在你的Application的build.gradle文件的allprojects
节点添加jitpack
库
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
在你的app的build.gradle文件的dependencies
节点添加RHWebApi
compile 'com.github.recwert:UploadManager:1.0.2'
UploadManager uploadManager = new AliyunUploadManager(this, new OSSPlainTextAKSKCredentialProvider("<ACCESS-KEY>","<SCRECT-KEY>", "<bucket-name>);
BitmapUploadAsyncTask uploadAsyncTask = new BitmapUploadAsyncTask(uploadManager, null);
uploadAsyncTask.setUploadCallback(this);
uploadAsyncTask.execute("image-url");
protected void onDestroy() {
if(uploadAsyncTask != null){
uploadAsyncTask.onDestroy();
}
super.onDestroy();
}