I am using AdMob banner ads in multi-process. It is working fine on API version lower than 29 but on android-P, it is giving this error.
com.google.android.
in case when you deals with ads, in application class
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val process = getProcessName()
if (packageName != process) WebView.setDataDirectorySuffix(process)
}
MobileAds.initialize(this)
AudienceNetworkAds.initialize(this)
} catch (e: Error) {
Timber.e(e)
} catch (e: Exception) {
Timber.e(e)
}
Notice this line in your error:
" Caused by: java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supported.
"
It means your app is using 2 or more processes and you need to set a different WebView
directory for each process (the main process already have the default folder), as explained in my question and answer here.
On Android 9.0 API 28, call WebView.setDataDirectorySuffix("any-folder-name")
when the second process is running, before you use any WebView
.