no-arg and settings persistence
See original GitHub issueHello!
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:
- Created 3 years ago
- Comments:12 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 thejvm
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 addrelease
as a matching fallback for myprerelease
build type: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?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.