Build.gradle(приложение модуля)
Код: Выделить всё
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.fusion.alen.ask"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
androidExtensions {
experimental = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
repositories {
mavenCentral()
}
Build.gradle(проект модуля)< /p>
Код: Выделить всё
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext{
kotlin_version = '1.2.71'
compiler_version = '3.2.1'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Класс данных «Мой пользователь»:
Код: Выделить всё
data class User(val name: String,
val email: String,
val uid: String,
val photo: String,
val postsList: ArrayList = ArrayList(),
val questionsNum: Int = 0,
val followersNum: Int = 0,
val followingNum: Int = 0
)
Код: Выделить всё
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding = ProfileFragmentBinding.inflate(inflater, container, false)
binding.user = user
}
Как я могу решить эту проблему? Я следовал инструкциям из документации DataBinding и не думаю, что допустил какую-либо ошибку. Я пробовал очистить и перестроить проект, но это не сработало. Я пробовал добавить эти зависимости «kapt», но не сработало....
File->ProjectStructure->Gradle версия: 4.10.1, AndroidPluginVersion: 3.2.1, KotlinLanguageVersion: 1.2, KotlinPluginVersion: 1.2.71 -release-Studio3.2-1
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/545 ... onflicting