apache / apache/cordova-android

Increased number of ANRs after updating to Android 12 platform

Open
#1,650 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

# Bug Report

## Problem
Google Android Vitals are reporting an increased amount of ANRs after updating to the Cordova Android 12 platform.

## Information
I am unsure if the ANRs are caused by the new Cordova platform update or by the new Android SDK version. Since I was unable to find any issue similar to this, I decided to open one here. Any information related to this ANR would be most helpful, as I am unable to reproduce it. I am also curious if any other developers are experiencing the same thing.

### Google stack trace

```
"main" tid=1 Blocked
at android.content.res.AssetManager.getResourceValue (AssetManager.java:545)
at android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:232)
at android.content.res.Resources.getInteger (Resources.java:1192)
at org.chromium.ui.base.DeviceFormFactor.isTablet (chromium-TrichromeWebViewGoogle.aab-stable-579016630:9)
at J.N.Mq8l4Aae (Native method)
at org.chromium.android_webview.AwContents.A (chromium-TrichromeWebViewGoogle.aab-stable-579016630:373)
at org.chromium.android_webview.AwContents. (chromium-TrichromeWebViewGoogle.aab-stable-:383)
at com.android.webview.chromium.k.run (chromium-TrichromeWebViewGoogle.aab-stable-579016630:111)
at WV.QB0.b (chromium-TrichromeWebViewGoogle.aab-stable-579016630:20)
at WV.PB0.run (chromium-TrichromeWebViewGoogle.aab-stable-579016630:3)
at org.chromium.base.task.PostTask.d (chromium-TrichromeWebViewGoogle.aab-stable-579016630:11)
at WV.QB0.a (chromium-TrichromeWebViewGoogle.aab-stable-579016630:28)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.a (chromium-TrichromeWebViewGoogle.aab-stable-579016630:3)
at com.android.webview.chromium.WebViewChromium.init (chromium-TrichromeWebViewGoogle.aab-stable-579016630:332)
at android.webkit.WebView. (WebView.java:443)
at android.webkit.WebView. (WebView.java:363)
at android.webkit.WebView. (WebView.java:345)
at android.webkit.WebView. (WebView.java:332)
at org.apache.cordova.engine.SystemWebView. (SystemWebView.java:47)
at org.apache.cordova.engine.SystemWebView. (SystemWebView.java:43)
at org.apache.cordova.engine.SystemWebViewEngine. (SystemWebViewEngine.java:76)
at java.lang.reflect.Constructor.newInstance0 (Native method)
at java.lang.reflect.Constructor.newInstance (Constructor.java:343)
at org.apache.cordova.CordovaWebViewImpl.createEngine (CordovaWebViewImpl.java:82)
at org.apache.cordova.CordovaActivity.makeWebViewEngine (CordovaActivity.java)
at org.apache.cordova.CordovaActivity.makeWebView (CordovaActivity.java)
at org.apache.cordova.CordovaActivity.init (CordovaActivity.java:153)
at org.apache.cordova.CordovaActivity.loadUrl (CordovaActivity.java:234)
at com.appname.MainActivity.onCreate (MainActivity.java:40)
at android.app.Activity.performCreate (Activity.java:8050)
at android.app.Activity.performCreate (Activity.java:8030)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3648)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3832)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2247)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7881)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1045)

```

### Environment, Platform, Device
The ANR details specify that this ANR has been reported on Android 11, Android 12 and Android 13 devices. Here are some of the specific devices: BLU M0176_ND, NUU T0801LAV2, samsung a20p, samsung gta4lwifi, motorola borneo.

### Version information
cordova 12.0.0
android 12.0.0

## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start with the supplied ANR stack trace, especially CordovaActivity.init, CordovaWebViewImpl.createEngine, and SystemWebViewEngine construction. Compare behavior across Android 11, 12, and 13 with cordova-android 12.0.0, then determine whether the ANR is attributable to Cordova or the Android SDK. Done means the cause is reproduced or ruled out and a focused fix or documented conclusion is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.