Тип программы уже существует: android.arch.lifecycle.LiveData $ LifecycleBoundObserver Сообщение {kind = ERROR, text = Тип программы уже присутствует: android.arch.lifecycle.LiveData $ LifecycleBoundObserver, sources = [Неизвестный исходный файл], имя инструмента = Optional.of (D8)}
У меня есть ошибка вроде этой, пожалуйста, кто-нибудь, дайте мне пример просмотра маклера с firebase-ui-database 3.1.3, потому что у меня стек TT
это мой HomeFragment
package com.fish.isyania.aplikasipemesananreparasi.fragment
import android.content.Context import android.net.Uri import android.os.Bundle import android.support.v4.app.Fragment import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.firebase.ui.database.FirebaseRecyclerAdapter import com.firebase.ui.database.FirebaseRecyclerOptions
import com.fish.isyania.aplikasipemesananreparasi.R import com.fish.isyania.aplikasipemesananreparasi.model.Promo import com.google.firebase.database.DatabaseReference import com.google.firebase.database.FirebaseDatabase import com.squareup.picasso.Picasso import kotlinx.android.synthetic.main.diskon_row.view.* import kotlinx.android.synthetic.main.diskon_row.view.promoImage
class HomeFragment : Fragment() {
lateinit var mRecyclerView: RecyclerView
lateinit var mDatabase: DatabaseReference
lateinit var options : FirebaseRecyclerOptions<Promo>
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView = inflater.inflate(R.layout.fragment_home, container, false)
mDatabase = FirebaseDatabase.getInstance().getReference("Promo")
mRecyclerView = rootView.findViewById(R.id.promoRc)
mRecyclerView.setHasFixedSize(true)
mRecyclerView.setLayoutManager(LinearLayoutManager(context))
logRecyclerView()
return rootView
}
private fun logRecyclerView() {
var FirebaseRecyclerAdapter = object : FirebaseRecyclerAdapter<Promo, PromoViewHolder>(options){
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PromoViewHolder {
var view: View = LayoutInflater.from(context)
.inflate(R.layout.diskon_row, parent, false)
return PromoViewHolder(view)
}
override fun onBindViewHolder(holder: PromoViewHolder, position: Int, model: Promo) {
Picasso.with(context).load(model!!.image).into(holder!!.itemView.rootView.promoImage)
}
// override fun populateViewHolder(viewHolder: PromoViewHolder?, model: Promo?, position: Int) { // //viewHolder??.itemView.userName.setText(model.name) // Picasso.with(context).load(model!!.image).into(viewHolder!!.itemView.rootView.promoImage) // }
}
mRecyclerView.adapter = FirebaseRecyclerAdapter
}
companion object {
fun newInstance(): HomeFragment = HomeFragment()
}
class PromoViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView){
} }
это моя промо модель
package com.fish.isyania.aplikasipemesananreparasi.model
import com.google.firebase.database.IgnoreExtraProperties
@IgnoreExtraProperties
class Promo {
var name: String = ""
var image: String = ""
var diskon: Long = 0
constructor() {}
constructor(name: String, image: String, diskon: Long) {
this.name = name
this.image = image
this.diskon = diskon
}
}
это мой gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.fish.isyania.aplikasipemesananreparasi"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.3'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'