I have created a service which i am calling through MainActivity.kt by sending an intent. I have declared the service in the ActivityManifest.xml under application but still i am getting the below error. Can anybody help me with this
I am sending the intent like this: startActivity(Intent(this@MainActivity, FloatingWindowApp::class.java))
FATAL EXCEPTION: main
Process: com.example.windowmanager, PID: 12897
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.windowmanager/com.example.windowmanager.FloatingWindowApp}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2065)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5314)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.kt:704)
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WindowManager"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.WindowManager">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".FloatingWindowApp"
tools:ignore = "Instantiable"/>
</application>
</manifest>
I have tried declaring the service file in the ActivityManifest.xml under the parent application but still I am getting the same. It is expected that this error doesn’t come