У меня есть проект в Android Studio 3.5, и я пытаюсь добавить модуль в Gradle, используя проект реализации (': data'), и он не работает.
Я импортировал Retrofit и Okhttp3 под своим "data ", но он продолжает говорить" Cannot Resolve Symbol Retrofit ". Это означает, что он не может найти импорт.
Это старый проект, который работал, но как только я открываю его в Android Studio 3.5, у него начинаются проблемы.
Этокод моего приложения Gradle ниже:
// app Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example.assign"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
supportlib = '26.0.0'
constraintlay = '1.0.2'
annotations = '27.0.2'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Support lib
implementation "com.android.support:appcompat-v7:$supportlib"
implementation "com.android.support:design:$supportlib"
implementation "com.android.support:support-v4:$supportlib"
implementation "com.android.support:support-annotations:$annotations"
implementation "com.android.support.constraint:constraint-layout:$constraintlay"
implementation project(':data')
}
Это мои данные код Gradle ниже:
// data Gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
ext {
retrofit = '2.4.0'
okhttp3 = '3.11.0'
gson = '2.8.1'
annotations = '27.0.2'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:support-annotations:$annotations"
// Network
implementation "com.google.code.gson:gson:$gson"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
implementation "com.squareup.okhttp3:okhttp:$okhttp3"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3"
}