最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Theme isn't set to use Theme.AppCompat or Theme.MaterialComponents - Stack Overflow

programmeradmin3浏览0评论

I’m working on an Android project that uses Stripe for payments, and I'm encountering an error stating: "Theme isn't set to use Theme.AppCompat or Theme.MaterialComponents."

Issue:

The error message appears when attempting to integrate Stripe into my project, and it seems to be related to the theme configuration in the project. Even though I have specified the theme correctly in both the styles.xml and AndroidManifest.xml, I am still facing the error. The error message suggests that the Stripe SDK cannot find a theme that uses Theme.AppCompat or Theme.MaterialComponents.

<?xml version="1.0" encoding="utf-8"?>
@drawable/launch_background false false false shortEdges
<!-- Theme applied to the Android Window once the process starts, used for the Flutter UI initialization -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="colorPrimary">@color/primaryColor</item>
</style>

<!-- Theme for Splash Screen -->
<style name="Theme.AppCompat" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/primaryColor</item>
    <item name="windowSplashScreenAnimatedIcon">@drawable/splash_inset</item>
    <item name="postSplashScreenTheme">@style/Theme.MyApp</item>
</style>

<!-- Normal Theme -->
<style name="NormalTheme" parent="Theme.MaterialComponents">
    <item name="android:windowBackground">?android:colorBackground</item>
</style>

AndroidManifest.xml

<manifest xmlns:android=";
package="">

<!-- Permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<!-- Application Details -->
<application
    android:name="${applicationName}"
    android:label="Life Italy"
    android:theme="@style/Theme.MyApp"
    android:icon="@mipmap/ic_launcher">

    <!-- Main Activity -->
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:theme="@style/Theme.AppCompat"
        android:windowSoftInputMode="adjustResize">
        
        <!-- Flutter Theme Metadata -->
        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/LaunchTheme" />

        <meta-data
            android:name="io.flutter.embedding.android.SplashScreenDrawable"
            android:resource="@drawable/launch_background" />

        <!-- Main Activity Intent Filter -->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- Flutter Embedding Metadata -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

<!-- Queries for Process Text Intent -->
<queries>
    <intent>
        <action android:name="android.intent.action.PROCESS_TEXT" />
        <data android:mimeType="text/plain" />
    </intent>
</queries>
发布评论

评论列表(0)

  1. 暂无评论