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.chendongde310:Gank:1.0.3'
}
dependencies {
implementation("com.github.chendongde310:Gank:1.0.3")
}
<dependency>
<groupId>com.github.chendongde310</groupId>
<artifactId>Gank</artifactId>
<version>1.0.3</version>
</dependency>
libraryDependencies += "com.github.chendongde310" % "Gank" % "1.0.3"
:dependencies [[com.github.chendongde310/Gank "1.0.3"]]
基于retrofit的网络请求整合库,可以直接获取图片、新闻、视频等资源调用,免去了接口开发流程,更专注功能研发
目前整合数据:图片(PicManager)+ 新闻 (NewsManager)+ 文章精选(ReadManager) +(福利图 →.→) 视频 、音乐陆续添加中
提供给gsd1602的小伙伴免费使用
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.chendongde310:Gank:1.0.3'
}
#####First 在Application中初始化
//初始化服务器
NetWorkRequest.getInstance().initGank(this);
//设置开发者模式 ,默认为 false
NetWorkRequest.setDeveloperMode(true);
PicManager.getInstance()// 获取接口实例
.getAllPicList()// 获取所有图片
.enqueue(new Callback<PicsBean>() {//enqueue 异步请求
@Override
public void onResponse(Call<PicsBean> call, final Response<PicsBean> response) {
// xxx..
}
@Override
public void onFailure(Call<PicsBean> call, Throwable t) {
t.printStackTrace();
}
});
在Application中初始化
//自定义retrofit
NetWorkRequest.getInstance().init(this,YOU_URL);
//设置开发者模式
NetWorkRequest.setDeveloperMode(true);
//使用方法
NetWorkRequest.getInstance().create(YourService.class);