-
Notifications
You must be signed in to change notification settings - Fork 67
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
After update to 1.0.0, Its crashing on Android. working fine on iOS #166
Comments
I see |
@russhwolf No, I am running the build in release mode. Using it for 2 years but first time I've had such an issue. Is there any extra workaround for this I'm not able to figure out? Crash line: val settings: Settings = Settings() |
hi @russhwolf such as MyApplication extends Application {
override fun onCreate {
// getSettings() <---- access settings here result into a crash
if (isMainProcess()){
// getSettings() <---- access settings here does not cause a crash
}
}
private fun isMainProcess(): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
return packageName == processName
}
return packageName == getProcessNameLegacy()
}
// You can use this method to get the current process name
private fun getProcessNameLegacy(): String? {
try {
val mypid = android.os.Process.myPid()
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val infos = manager.runningAppProcesses
for (info in infos) {
if (info.pid == mypid) {
return info.processName
}
}
} catch (e: Exception) {
// Handle the exception if needed
}
// May never return null
return null
}
} same goes for koin because koin is called at |
@vinod6124 I've never seen this issue before, but one workaround would be to manually inject your @ahna92 I'm not clear whether your issue is the same one as was originally reported here or not. But in any case |
@russhwolf i'll share stack trace below ,
but i mentioned the multi process bc the crash did stoped happing when only invoking the lib in main process I just noticed the
|
I don't think 1.1.0 will have solved this issue (I'm still not sure what's going on here), but try upgrading if you get a chance and let me know if we got lucky. |
For folks who are experiencing this issue, are you using androidx.startup elsewhere in your app? If so what version? Are you doing any customization in your AndroidManifest of when initializers are run, such as the sort of config described here? |
@russhwolf I'm using android.startup with version 1.1.1 and getting the same issue as described above if I add custom initializer (not in tests). In my case crash happens because my custom initializer should depend on |
I'm planning to make |
1.2 is now out. I'd love to hear if there are crashes people are still experiencing that can't be worked around using the now-public |
The text was updated successfully, but these errors were encountered: