Reputation: 353
I'm facing an unusual issue where i'm not able to use webview anywhere in my app. It is giving following exception.
Caused by: android.view.InflateException: Binary XML file line #35: Binary XML file line #35: Error inflating class android.webkit.WebView
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class android.webkit.WebView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at com.mobile.base.BaseActivity.onCreate(BaseActivity.kt:26)
at com.mobile.module.web_view.Hilt_FSWebViewActivity.onCreate(Hilt_FSWebViewActivity.java:21)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.util.AndroidRuntimeException: java.lang.reflect.InvocationTargetException
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:230)
at android.webkit.WebView.getFactory(WebView.java:2467)
at android.webkit.WebView.ensureProviderCreated(WebView.java:2462)
at android.webkit.WebView.setOverScrollMode(WebView.java:2527)
at android.view.View.<init>(View.java:4536)
at android.view.View.<init>(View.java:4668)
at android.view.ViewGroup.<init>(ViewGroup.java:597)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
2021-05-10 20:05:57.056 28318-28318/com.mobile E/AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:636)
at android.webkit.WebView.<init>(WebView.java:581)
at android.webkit.WebView.<init>(WebView.java:564)
at android.webkit.WebView.<init>(WebView.java:551)
... 30 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:225)
... 41 more
Caused by: java.lang.RuntimeException: Package not found: com.android.chrome
at android.webkit.WebViewDelegate.getPackageId(WebViewDelegate.java:164)
at sX3.b(chromium-Monochrome.aab-stable-443009121:1)
at com.android.webview.chromium.WebViewChromiumFac`enter code here`toryProvider.e(chromium-Monochrome.aab-stable-443009121:35)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.<init>(chromium-Monochrome.aab-stable-443009121:12)
at com.android.webview.chromium.WebViewChromiumFactoryProviderForO.<init>(chromium-Monochrome.aab-stable-443009121:1)
at com.android.webview.chromium.WebViewChromiumFactoryProviderForO.create(chromium-Monochrome.aab-stable-443009121:1)
... 43 more
I created a different app with only one activity containing webview and it is working fine.
Please help me in understanding what might be the issue.
compileSdkVersion 29
minSdkVersion 24
targetSdkVersion 29
// Android Libraries
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.fragment:fragment-ktx:1.3.3'
// Google Libraries
//implementation 'com.google.code.gson:gson:2.8.6'
// Kotlin Libraries
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21"
// Rx
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation 'io.reactivex:rxandroid:1.2.1'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.7.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'
implementation 'io.reactivex:rxandroid:1.2.1'
// Image Processing
implementation('com.github.bumptech.glide:glide:4.11.0')/* {
exclude group: "com.android.support"
}*/
//implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
// ROOM
implementation 'androidx.room:room-runtime:2.2.6'
kapt 'androidx.room:room-compiler:2.2.6'
testImplementation "androidx.room:room-testing:2.2.6"
// Testing Libraries
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//HILT - DI Dependencies
implementation "com.google.dagger:hilt-android:$hilt_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
kapt 'androidx.hilt:hilt-compiler:1.0.0-beta01'
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
//Lifecycle
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
//Data binding
annotationProcessor 'androidx.databinding:databinding-compiler:4.1.3'
//Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
//Material Design Components
implementation 'com.google.android.material:material:1.3.0'
//Coroutines
def coroutines_version = "1.4.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
//Lifecycle LiveData
def lifecycle_version = "2.3.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation project(path: ':googlecloudtts')
// Dynamic Feature Module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
implementation 'com.google.android.material:material:1.4.0-alpha02'
implementation 'com.romandanylyk:pageindicatorview:1.0.3'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation ('com.akexorcist:localization:1.2.9') {
exclude group: 'androidx.core', module: 'core'
}
implementation 'com.ramotion.directselect:direct-select:0.1.1'
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'org.conscrypt:conscrypt-android:2.2.1'
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation "com.google.firebase:firebase-messaging:21.1.0"
implementation 'com.google.firebase:firebase-core:18.0.3'
implementation 'com.google.firebase:firebase-analytics'
Project has an other submodule which has a module level dependencies as below:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.google.code.gson:gson:2.8.6'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.json:json:20160810'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
Upvotes: 2
Views: 2739
Reputation: 353
I found the issue with the code.
It was related to localization library com.akexorcist:localization:1.2.9
Please check the issues section in github: https://github.com/akexorcist/Localization/issues/105
Issue is solved in com.akexorcist:localization:1.2.10
Upvotes: 3