breautek commented on issue #1559:
URL: 
https://github.com/apache/cordova-android/issues/1559#issuecomment-1472184713

   > @breautek So I tried both just removing the AppCompat theme from the item 
in the config file as well as adding it as an AndroidPostSplashScreenTheme in . 
In both cases I'm getting this error.
   > 
   > `java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.company/com.company.MainActivity}: 
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or 
descendant) with this activity.`
   > 
   > Could it be something else interfering ? Is your intent filter section 
different ?
   
   Something else could be interfering. The cordova CLI sets up the native 
project, and you can view the AndroidManifest at  
`<cordovaProject>/platforms/android/app/src/main/AndroidManifest.xml`. It 
**should** have `android:theme="@style/Theme.App.SplashScreen"` on the activity 
element. If it doesn't, you'll have problems.
   
   Although the error seems like it's actually passing the splashscreen stage 
is now trying to render the main activity. `CordovaActvity` extends 
`AppCompatActivity`, which is why I think it reqiures a `Theme.AppCompat` theme 
(like `Theme.AppCompat.NoActionBar`)
   
   You can check 
`<cordovaProject/platforms/android/app/src/main/res/values/themes.xml`.
   
   It should contain:
   
   ```
   <item name="postSplashScreenTheme">@style/Theme.AppCompat.NoActionBar</item>
   ```
   
   Where the assigned theme is controlled by the `AndroidPostSplashScreenTheme` 
preference, but it defaults to `@style/Theme.AppCompat.NoActionBar`. If this is 
set to a non `AppCompat` theme, then I expect it's the source of your current 
year.
   
   If you have a plugin or something overriding the `themes.xml` file, it must 
produce something that has the following:
   
   ```xml
   <?xml version='1.0' encoding='utf-8'?>
   <resources>
       <style name="Theme.App.SplashScreen" 
parent="Theme.SplashScreen.IconBackground">
           <item 
name="windowSplashScreenBackground">@color/cdv_splashscreen_background</item>
           <item 
name="windowSplashScreenAnimatedIcon">@drawable/ic_cdv_splashscreen</item>
           <item name="windowSplashScreenAnimationDuration">200</item>
           <item 
name="postSplashScreenTheme">@style/Theme.AppCompat.NoActionBar</item>
       </style>
   </resources>
   ```


-- 
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