Skip to content
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

ANR caused by Moshi during SmileID.initialize #487

Open
natintosh opened this issue Nov 15, 2024 · 1 comment
Open

ANR caused by Moshi during SmileID.initialize #487

natintosh opened this issue Nov 15, 2024 · 1 comment

Comments

@natintosh
Copy link

com.squareup.moshi.JsonUtf8Writer.<clinit>
 at java.lang.Integer.valueOf (Integer.java:1206)
  at com.squareup.moshi.JsonUtf8Writer.<clinit> (JsonUtf8Writer.java:52)
  at com.squareup.moshi.JsonReader$Options.of (JsonReader.java:637)
  at com.smileidentity.models.ConfigJsonAdapter.<init> (Config.kt:20)
  at java.lang.reflect.Constructor.newInstance0 (Native method)
  at java.lang.reflect.Constructor.newInstance (Constructor.java:343)
  at com.squareup.moshi.internal.Util.generatedAdapter (Util.java:588)
  at com.squareup.moshi.StandardJsonAdapters$1.create (StandardJsonAdapters.java:61)
  at com.squareup.moshi.Moshi.adapter (Moshi.java:146)
  at com.squareup.moshi.Moshi.adapter (Moshi.java:106)
  at com.squareup.moshi.Moshi.adapter (Moshi.java:80)
  at com.smileidentity.models.Config$Companion.fromAssets (Config.kt:26)
  at com.smileidentity.SmileID.initialize$default (SmileID.kt:69)

Likely cause might be from here

fun fromAssets(context: Context): Config {
try {
context.assets.open("smile_config.json").source().buffer().use {
return SmileID.moshi.adapter(Config::class.java).fromJson(it)
?: throw IllegalStateException("Failed to parse smile_config.json")
}
} catch (e: IOException) {
throw FileNotFoundException(
"smile_config.json not found in assets. Please ensure the file exists.",
)
}
}

@jumaallan
Copy link
Member

I'll fix this

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants