question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-arg and settings persistence

See original GitHub issue

Hello!

I’m facing the next issue: I’ve tested with no-arg module and everything looks good but… every time I close the app (Android), the preferences are being deleted, is that behaviour expected??

For example, i’m testing something like this:

val settings = Settings()
println("Setting: " + settings.getBoolean("TEST"))
settings.putBoolean(("TEST", true)
println("Setting: " + settings.getBoolean("TEST"))

Every time I close the app, I get this output:

Setting: false
Setting: true

Lib version: 0.6 Kotlin version: 1.3.72

Maybe I’m missing something? Thanks for the lib!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dzolnaicommented, Oct 26, 2020

I finally found the culprit. The issue was that I was using a build type with a non-default name (prelease). That’s why it did not pair it with neither the debug version or the android release version of the library. I guess it matched with the jvm version because that one does not have any subtypes, so it matches anything, and android is a subtype of jvm… Anyways, the solution was to add release as a matching fallback for my prerelease build type:

buildTypes {
        ...
        prerelease {
            matchingFallbacks = ["release"]
            ...
        }
    }

I had to do this at all places where I had the prerelease build type defined, in common and also the android app. I still don’t know why this came up just now, I have at least 10 other Kotlin MP libraries in my app. Perhaps because this library publishes separate debug and release variants?

0reactions
russhwolfcommented, May 2, 2022

I’m pretty sure there’s nothing left to do here, so I’m closing this. Feel free to reopen, or start a discussion, if anyone is still having trouble.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No-arg compiler plugin - Kotlin
This allows the Java Persistence API (JPA) to instantiate a class although it doesn't have the zero-parameter constructor from Kotlin or ...
Read more >
no default constructor for JPA entity with Kotlin even with ...
I'm using Intellij IDEA with Kotlin 1.1.0, so for deployment I just click debug/run with Tomcat run configuration selected and for running test ......
Read more >
PersistenceUnitProperties (EclipseLink 2.6.9, API Reference)
The class defines EclipseLink persistence unit property names. These values are used to assist in the configuration of properties passed to Persistence.
Read more >
Chapter 2. Setup and configuration - Red Hat on GitHub
The configuration for entity managers both inside an application server and in a standalone application reside in a persistence archive.
Read more >
2. Enhancement - Apache OpenJPA
This flag tells the enhancer whether to add a protected no-arg constructor to any persistent classes that don't already have one. Defaults to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found