Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start activity ComponentInfo{com.app.optibiz/com.sample.edgedetection.scan.ScanActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity #188

Open
MSatyam-Mishra opened this issue Nov 28, 2024 · 0 comments

Comments

@MSatyam-Mishra
Copy link

MSatyam-Mishra commented Nov 28, 2024

Shutting down VM
E/AndroidRuntime(23268): FATAL EXCEPTION: main
E/AndroidRuntime(23268): Process: com.app.optibiz, PID: 23268
E/AndroidRuntime(23268): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.optibiz/com.sample.edgedetection.scan.ScanActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
E/AndroidRuntime(23268): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3991)
E/AndroidRuntime(23268): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4144)
E/AndroidRuntime(23268): 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
E/AndroidRuntime(23268): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
E/AndroidRuntime(23268): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:99)
E/AndroidRuntime(23268): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2589)
E/AndroidRuntime(23268): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(23268): 	at android.os.Looper.loopOnce(Looper.java:224)
E/AndroidRuntime(23268): 	at android.os.Looper.loop(Looper.java:318)
E/AndroidRuntime(23268): 	at android.app.ActivityThread.main(ActivityThread.java:8790)
E/AndroidRuntime(23268): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23268): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
E/AndroidRuntime(23268): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
E/AndroidRuntime(23268): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
E/AndroidRuntime(23268): 	at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:926)
E/AndroidRuntime(23268): 	at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:889)
E/AndroidRuntime(23268): 	at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:772)
E/AndroidRuntime(23268): 	at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:197)
E/AndroidRuntime(23268): 	at com.sample.edgedetection.base.BaseActivity.onCreate(BaseActivity.kt:16)
E/AndroidRuntime(23268): 	at android.app.Activity.performCreate(Activity.java:8891)
E/AndroidRuntime(23268): 	at android.app.Activity.performCreate(Activity.java:8856)
E/AndroidRuntime(23268): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1471)
E/AndroidRuntime(23268): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3973)

Androidmanifest.xml


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <queries>
        <!-- Intent Queries -->
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="sms" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="tel" />
        </intent>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SENDTO" />
            <data android:scheme="mailto" />
        </intent>
    </queries>
<queries>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="upi" android:host="pay"/>
  </intent>
</queries>

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

    <application
        android:label="OptiBiz"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:forceDarkAllowed="false"
        android:theme="@style/LaunchTheme" 
        android:usesCleartextTraffic="true"
        tools:replace="android:theme,android:usesCleartextTraffic">
        
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            
            >
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity 
        android:name="com.weipl.checkout.WLCheckoutActivity" 
        android:exported="true" 
        android:theme="@style/LightTheme" 
        tools:replace="android:theme" >
         <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="your-scheme-check-docu-for-info"/>
            </intent-filter>
            </activity>

    <activity
    android:name=".scan.ScanActivity"
    android:theme="@style/LightTheme"
    android:exported="true" >
    </activity>


        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Styles.xml


<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             the Flutter engine draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>

    <style name="LightTheme" parent="Theme.AppCompat.Light">
    <!-- Customize the theme if needed -->
    <!-- For example, set the primary color -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>


</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant