You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "breautek (via GitHub)" <gi...@apache.org> on 2023/03/14 20:43:23 UTC
[GitHub] [cordova-docs] breautek opened a new issue, #1290: Document Android Splashscreen theme quirk
breautek opened a new issue, #1290:
URL: https://github.com/apache/cordova-docs/issues/1290
A common issue people are having when upgrading to cordova-android@11 with the new splashscreen system is Google's compatibility library imposes a requirement on the app to use the splashscreen theme as the default starting theme. However many users are using custom configs and/or plugins to override this theme with another which causes the compatibility library to crash with an error message that isn't very useful.
The full stack trace as an example can be found below:
<details>
<summary>Stacktrace</summary>
```
E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.cordova.hellocordova, PID: 14640
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.cordova.hellocordova/io.cordova.hellocordova.MainActivity}: android.view.InflateException: Binary XML file line #24 in io.cordova.hellocordova:layout/splash_screen_view: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0300df a=-1}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.view.InflateException: Binary XML file line #24 in io.cordova.hellocordova:layout/splash_screen_view: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0300df a=-1}
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0300df a=-1}
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:825)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:7932)
at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:8130)
at android.widget.FrameLayout$LayoutParams.<init>(FrameLayout.java:452)
at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:380)
at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:58)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at android.view.View.inflate(View.java:25742)
at androidx.core.splashscreen.SplashScreenViewProvider$ViewImpl$_splashScreenView$2.invoke(SplashScreenViewProvider.kt:94)
at androidx.core.splashscreen.SplashScreenViewProvider$ViewImpl$_splashScreenView$2.invoke(SplashScreenViewProvider.kt:93)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.core.splashscreen.SplashScreenViewProvider$ViewImpl.get_splashScreenView(SplashScreenViewProvider.kt:93)
at androidx.core.splashscreen.SplashScreenViewProvider$ViewImpl.createSplashScreenView(SplashScreenViewProvider.kt:103)
at androidx.core.splashscreen.SplashScreenViewProvider.<init>(SplashScreenViewProvider.kt:52)
at androidx.core.splashscreen.SplashScreen$Impl.setOnExitAnimationListener(SplashScreen.kt:305)
at androidx.core.splashscreen.SplashScreen.setOnExitAnimationListener(SplashScreen.kt:185)
at org.apache.cordova.SplashScreenPlugin.setupSplashScreen(SplashScreenPlugin.java:141)
at org.apache.cordova.SplashScreenPlugin.onMessage(SplashScreenPlugin.java:113)
at org.apache.cordova.PluginManager.lambda$postMessage$0(PluginManager.java:345)
at org.apache.cordova.PluginManager$$ExternalSyntheticLambda0.accept(Unknown Source:8)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at java.util.Collections$SynchronizedMap.forEach(Collections.java:2698)
at org.apache.cordova.PluginManager.postMessage(PluginManager.java:343)
at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:161)
at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:234)
at io.cordova.hellocordova.MainActivity.onCreate(MainActivity.java:40)
E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
```
</details>
This should be documented in some fashion in our [Quirks](https://cordova.apache.org/docs/en/11.x/core/features/splashscreen/index.html#android) section. I don't think we need ot include the entire stack, but key parts like
```
Caused by: android.view.InflateException: Binary XML file line #24 in io.cordova.hellocordova:layout/splash_screen_view: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0300df a=-1}
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0300df a=-1}
```
References:
https://github.com/apache/cordova-android/issues/1559
https://github.com/apache/cordova-android/issues/1534
https://github.com/apache/cordova-android/issues/1497
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-docs] andreszs commented on issue #1290: Document Android Splashscreen theme quirk
Posted by "andreszs (via GitHub)" <gi...@apache.org>.
andreszs commented on issue #1290:
URL: https://github.com/apache/cordova-docs/issues/1290#issuecomment-1698190609
The workaround I found (so far) is to edit **AndroidManifest.xml** and replace:`android:theme="@style/Theme.AppCompat.NoActionBar"`
with:
`android:theme="@style/Theme.App.SplashScreen"`
**However, everytime the app is built, this change is reverted**.
Any ideas on how to workaround this issue? This constant double-building is really tiresome and inconvenient.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-docs] breautek commented on issue #1290: Document Android Splashscreen theme quirk
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1290:
URL: https://github.com/apache/cordova-docs/issues/1290#issuecomment-1698197466
> The workaround I found (so far) is to edit **AndroidManifest.xml** and replace:`android:theme="@style/Theme.AppCompat.NoActionBar"` with: `android:theme="@style/Theme.App.SplashScreen"`
>
> **However, everytime the app is built, this change is reverted**.
>
> Any ideas on how to workaround this issue? This constant double-building is really tiresome and inconvenient.
You'll have to find what is actually manipulating the theme. Assuming that your project doesn't have a `edit-config` rule that makes this modification in your `config.xml`, then there is likely a plugin that is responsible. You can probably do a "find in folder" search on your `plugins/` folder to see which `plugin.xml` has `Theme.AppCompat.NoActionBar` keyword.
Once you pinpoint the plugin that is overwriting that change, then you'll have to ask the maintainers of the plugin to solve the problem, or fork the plugin and make the change required.
`@style/Theme.App.SplashScreen` is the value that Cordova itself uses and, and the theme is defined in `themes.xml`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-docs] andreszs commented on issue #1290: Document Android Splashscreen theme quirk
Posted by "andreszs (via GitHub)" <gi...@apache.org>.
andreszs commented on issue #1290:
URL: https://github.com/apache/cordova-docs/issues/1290#issuecomment-1698167921
What's the more straightforward solution / workaround to this error?
I have the following plugins installed and it would take a long time to uninstall each one to find the plugin that's causing the problem:
```
@havesource/cordova-plugin-push 3.0.1 "Cordova Push Plugin"
@red-mobile/cordova-plugin-barcodescanner 9.0.8 "BarcodeScanner"
cordova-plugin-biometric-auth 1.0.1 "BiometricAuth"
cordova-plugin-camera 6.0.0 "Camera"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-in-app-updates 2.0.5 "InAppUpdate"
cordova-plugin-inappbrowser 5.0.0 "InAppBrowser"
cordova-plugin-native-spinner 1.1.4 "Native Spinner"
cordova-plugin-network-information 3.0.0 "Network Information"
cordova-plugin-sms-retriever 4.0.1 "SMS Retriever"
cordova-plugin-statusbar 3.0.0 "StatusBar"
nl.madebymark.share 0.1.1 "Share"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-docs] andreszs commented on issue #1290: Document Android Splashscreen theme quirk
Posted by "andreszs (via GitHub)" <gi...@apache.org>.
andreszs commented on issue #1290:
URL: https://github.com/apache/cordova-docs/issues/1290#issuecomment-1698236554
Thanks Norman, instead of dealing all the plugins I simply added this to my **config.xml** to have the proper style set automatically on build time:
```xml
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<activity android:theme="@style/Theme.App.SplashScreen"></activity>
</edit-config>
```
For anyone else in search for this solution, this requires the XML namespace `xmlns:android="http://schemas.android.com/apk/res/android"` in your `widget `element in config.xml.
I've wasted a complete afternoon at work dealing with this after updating to cordova-android-11. A small footnote in the [Quirks](https://cordova.apache.org/docs/en/11.x/core/features/splashscreen/index.html#android) section would've been really useful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org