我尝试在我的项目中添加Retrofit2。我做了这样的行动:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileOptions.encoding = "windows-1251"
defaultConfig {
applicationId "ua.grant.smart"
minSdkVersion 14
targetSdkVersion 25
versionCode 3
versionName "1.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:support-core-ui:25.3.1'
compile 'com.android.support:support-fragment:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
}
}
dependencies {
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
}
App(顶级)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
答案 0 :(得分:1)
从
修改android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileOptions.encoding = "windows-1251"
defaultConfig {
applicationId "ua.grant.smart"
minSdkVersion 14
targetSdkVersion 25
versionCode 3
versionName "1.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:support-core-ui:25.3.1'
compile 'com.android.support:support-fragment:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
}
}
dependencies {
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
}
要
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileOptions.encoding = "windows-1251"
defaultConfig {
applicationId "ua.grant.smart"
minSdkVersion 14
targetSdkVersion 25
versionCode 3
versionName "1.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-core-ui:25.3.1'
compile 'com.android.support:support-fragment:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
}