为什么不帮我?
在我的应用程序中,我想使用ButterKnife库,然后添加该库依赖项。但是,当添加此库并单击“ 同步”按钮时。
无法同步项目,并显示错误。
gradle.Build(项目):
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
gradle.build(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mohammad.ncistutorial"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我想从服务器获取数据并将其显示到中RecyclerView。
为了从服务器获取数据,我使用Retrofit2,并编写以下代码。
但一段时间后,运行应用程序时,告诉我E/priceResLog: Err : SSL handshake timed out在onFailure从Retrofit2!
我的代码:
public class ApiUtilsPrice {
private static final String BASE_URL = "https://core.arzws.com/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.build();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.client(okHttpClient)
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
Run Code Online (Sandbox Code Playgroud)
活动代码:
private void getCoinData() {
loaderLayout(true);
Call<GoldListResponse> call …Run Code Online (Sandbox Code Playgroud)