Christy-Kuruvilla-PWS opened a new issue, #1559:
URL: https://github.com/apache/cordova-android/issues/1559

   # Bug Report
   
   ## Problem
   
   After upgrading to Cordova 11.0.0 from 8.0.0, the app is crashing on the 
splash screen. Before this error I hadn't changed the config.xml to handle the 
new splash screen for API level 31 and up. Even without doing anything API 
levels 31 and up work without crashing and show the icon during the splash. 
   
   ### What is expected to happen?
   
   Launch normally in api level 30 and below after splash, just like api 31 and 
up.
   
   ### What does actually happen?
   
   it crashes on this line for splash_screen_view 
   .MainActivity}: android.view.InflateException: Binary XML file line #24  
layout/splash_screen_view
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   
   I saw this [ticket number 
1534](https://github.com/apache/cordova-android/issues/1534) that had a similar 
issue. I tried what was suggested and it didn't work for me. This ticket also 
mentioned [1479](https://github.com/apache/cordova-android/issues/1497), I also 
tied what was mentioned here which didn't work either. 
   
   The following [Cordova 11 
Doc](https://cordova.apache.org/docs/en/11.x/core/features/splashscreen/#configxml-preferences)
 mentions that the old <splash> tags are to be removed from the config.xml file 
and replaced with 'AndroidWindowSplashScreenAnimatedIcon'. I removed all my 
splash tags and added the new preference. The following is a copy of my Android 
platform config 
   
   `<platform name="android">
           <icon density="ldpi" 
src="resources/android/icon/drawable-ldpi-icon.png" />
           <icon density="mdpi" 
src="resources/android/icon/drawable-mdpi-icon.png" />
           <icon density="hdpi" 
src="resources/android/icon/drawable-hdpi-icon.png" />
           <icon density="xhdpi" 
src="resources/android/icon/drawable-xhdpi-icon.png" />
           <icon density="xxhdpi" 
src="resources/android/icon/drawable-xxhdpi-icon.png" />
           <icon density="xxxhdpi" 
src="resources/android/icon/drawable-xxxhdpi-icon.png" />
           <preference name="AndroidWindowSplashScreenAnimatedIcon" 
value="resources/splash.xml" />
           <preference name="AndroidWindowSplashScreenBackground" 
value="#6F7378" />
           <custom-config-file parent="/*" target="AndroidManifest.xml">
               <application android:allowBackup="false" 
android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" 
android:label="@string/app_name" android:supportsRtl="true">
                   <activity 
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" 
android:exported="true" android:label="@string/activity_name" 
android:launchMode="singleTop" android:name="MainActivity" 
android:theme="@style/Theme.AppCompat.NoActionBar" 
android:windowSoftInputMode="adjustResize">
                       <intent-filter android:label="@string/launcher_name">
                           <action android:name="android.intent.action.MAIN" />
                           <category 
android:name="android.intent.category.LAUNCHER" />
                       </intent-filter>
                   </activity>
                   <meta-data android:name="io.fabric.ApiKey" 
android:value="3c7179891aba95719d1f9fb95f22ea4deed584f3" />
               </application>
           </custom-config-file>
       </platform>`
   
   I crated the xml file by converting a png to an svg and then using the svg 
in the Android Asset studio for Images to create the xml. I used a new temp 
project to do this and copied just the ic_launcher_foreground.xml. Is this 
wrong way to go about it? 
   The Cordova doc suggests that this is all that is needed for backward 
compatibility. 
   
   ### Crash Report
   
   `D/PluginManager: startupPlugins: put - CoreAndroid
   D/PluginManager: postMessage: setupSplashScreen
   D/AndroidRuntime: Shutting down VM
   E/AndroidRuntime: FATAL EXCEPTION: main
       Process: com.company.app, PID: 1832
       java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.company.app/com.company.app.MainActivity}: 
android.view.InflateException: Binary XML file line #24 in 
com.company.app: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:3449)
           at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
           at 
android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
           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:2066)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:223)
           at android.app.ActivityThread.main(ActivityThread.java:7656)
           at java.lang.reflect.Method.invoke(Native Method)
           at 
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
        Caused by: android.view.InflateException: Binary XML file line #24 in 
com.company.app: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:826)
           at 
android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:8231)
           at 
android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:8429)
           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:1123)
           at 
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
           at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
           at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
           at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
           at android.view.View.inflate(View.java:26707)
           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 com.company.app.MainActivity.onCreate(MainActivity.java:40)
           at android.app.Activity.performCreate(Activity.java:8000)
   E/AndroidRuntime:     at 
android.app.Activity.performCreate(Activity.java:7984)
           at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
           at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
           at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
           at 
android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
           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:2066)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:223)
           at android.app.ActivityThread.main(ActivityThread.java:7656)
           at java.lang.reflect.Method.invoke(Native Method)
           at 
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)`
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   cordova prepare 
   
   grunt init
   
   cordova build android --debug
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   Android API level <= 30
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Mac OS Bug Sur 11.7.1
   
   Android Studio Electric Eel | 2022.1.1
   
   Cordova Android 11.0.0
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   
   - [ Y]  I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version
   - [ Y] I included all the necessary information above
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to