-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassNotFoundException: com.otaliastudios.firestore.FirestoreMapMetadataImpl #11
Comments
It should definitely be found. However, if it was totally missing, you'd get this error very frequently. Not sure what's going on. Does this maybe happen only on builds with proguard on? |
Hi Mattia, thanks for the speedy response. Much appreciated. This issue seems to affect debug builds. Once the build has succeeded I'm unable to find the file I built the demo project, and I also can't find I noticed that demo/proguard-rules.pro do not contain any rules. It would be great to get to the bottom of this issue, and perhaps include some advice on proguard in the README. Should the Very much appreciate any help, as we'd love to use this library! |
Could you share the model class that you are using? The @FirestoreClass that's causing this issue. Or if you don't know which one, you can post all of them. I am thinking that maybe we don't currently support the way you're using it. |
I'm dynamically creating some properties. This seems to work fine, mostly e.g. It would be great to understand whether The error is created at I doubt this, but I thought I'd ask whether using the optional generic type @FirestoreClass
class EventHistory : FirestoreMap<Any>() {
var lastEventOrdinal: Int by this
init {
lastEventOrdinal = 0
}
fun add(event: Event, user: User) {
val now = Timestamp.now()
if (user.lastSessionEnd.seconds + 600 < now.seconds) {
createNewSessionAndAdd(event, user, now)
}
else {
val sessionIndexKey = getSessionIndexKey(user.lastSessionIndex, user.lastSessionStart)
when (val session = this[sessionIndexKey] as? SessionHistory) {
null -> {
createNewSessionAndAdd(event, user, now)
}
session -> {
user.lastSessionEnd = now
lastEventOrdinal += 1
session.add(event, lastEventOrdinal)
}
}
}
}
private fun createNewSessionAndAdd(event: Event,
user: User,
now: Timestamp) {
val newSession = SessionHistory()
lastEventOrdinal = 0
newSession.add(event, 0)
user.lastSessionStart = now
user.lastSessionEnd = now
user.lastSessionIndex += 1
val newSessionIndexKey = getSessionIndexKey(user.lastSessionIndex, now)
this[newSessionIndexKey] = newSession
}
private fun getSessionIndexKey(sessionIndex: Int, timestamp: Timestamp): String {
val sessionIndexString = "$sessionIndex".padStart(4, '0')
val dateTime = SimpleDateFormat.getDateTimeInstance().format(timestamp.toDate())
return "Session $sessionIndexString - $dateTime"
}
}
@FirestoreClass
class SessionHistory : FirestoreMap<Event>() {
fun add(event: Event, eventOrdinal: Int) {
val time = SimpleDateFormat.getTimeInstance().format(Date())
val eventKey = "${"$eventOrdinal".padStart(4, '0')}: ${event.kind} - $time"
this[eventKey] = event
}
} |
I was wrong saying that it should be created. It should not, so if it isn't, that's correct.
It shouldn't make any difference. Does the error appear any time you call add()? The demo app model has a similar structure, but it doesn't seem to show this issue. |
The error occurs only on some user devices/os so it's hard to nail down. I'll try to share more insights as the crashes come in. |
@DanielAsher do you have more information by any chance? |
* Update dependencies, Gradle, Kotlin to 1.4.0, AGP to 4.0.1 * Add explicit API mode * Better build checks * Refactor * Update docs * Catch exception #11 * Release v0.7.0
Hi,
thanks for this great project. It makes firestore so much nicer to work with.
I'm getting a
java.lang.ClassNotFoundException: com.otaliastudios.firestore.FirestoreMapMetadataImpl
error occasionally and I've searched the source and kapt generated files but couldn't find any such file or class.Here is a summary stack trace:
Should this class be found, or is this a client-side coding error?
Cheers,
Daniel
The text was updated successfully, but these errors were encountered: