Reputation: 4530
I am using android studio 4.0.1 facing following issue
Tried File -> Invalidate caches / Restart this works once. Works for first run only on restart when I try to run it second time it again shows error default activity not found.
Also tried Edit Configurations... set Specified activity strange issue found it says activity not found in manifest
Here is code from manifest
<activity
android:name=".config.SplashActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Splash">
<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:host="domain.com"
android:pathPrefix="/"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="domain.app.link"
android:scheme="https" />
<data
android:host="domain.app.link"
android:scheme="https" />
</intent-filter>
</activity>
Update: Also tried File -> Sync Project with Gradle files not working. It is working only once start or restart android studio for second run this issue occurs
Update : Tried updating android studio to new version 4.0.2 still facing the same issue
Upvotes: 1
Views: 1581
Reputation: 2165
This same issue happened to me couple of days back and was corrected by using the complete name of my activity including my package name in the manifest file (Strange issue). So in your case use
<activity
android:name="com.my_package.android.config.SplashActivity" //<---this line
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Splash">
This process worked for me after 2 tries and after that there is no issue till date.
Upvotes: 0
Reputation: 602
First You need to close your android studio Then do this
1 .android
2 .AndroidStudio
3 .gradle
from C:\Users[your user name]
Start Android studio ( Will take some time to rebuild)
Upvotes: 0
Reputation: 1913
You should give this a try:
Upvotes: 0
Reputation: 17360
Next a list of different actions you can try. Each entry in the list is a completely different solution independent from each other:
Ensure your manifest activity has the next intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>`
Edit your "Run / Debug Configurations". Change the "Launch" to "Default Activity". If your activity isn't the default one, then change back to "Specified Activity" but select it from the right menu button "the 3 dots button", and do not type manually the activity name.
Edit your "Run / Debug configuration". At the bottom of the "general" tab remove the "Gradle-aware Make" entry. Apply it and exit this window. Build your project, then open again "Run / Debug configuration", and add again the "Gradle-aware Make" entry.
Delete obsolete Android Studio data folders from previous installations. Under your folder "C:\Users\<Your user name>\", remove any older Android Studio folder from previous installations.
"Clean" your project using the option in the "Build" menu, and also use the "Invalidate Caches / Restart" option in Android Studio's File menu.
Do not qualify your activity in the manifest tag, so in your case leave it as:
android:name=".SplashActivity"
Do the opposite of solution 7, so fully qualify it:
android:name="com.my_package.android.config.SplashActivity"
Ensure your activity is defined as public:
public class SplashActivity extends Activity
This may not make any difference, but remove temporarily your activity's theme tag "android:theme="@style/Theme.AppCompat.Splash", just to ensure is not a style related issue which produces an invalid manifest.
Make a backup before proceeding with this solution. Close your project and delete the project's ".gradle" folder. This one will be autogenerated again next time you open it.
Create a new project and import your old project's code into it.
Fully reinstall Android Studio, so uninstall and install.
Upvotes: 1
Reputation: 809
This is kind of a hack. It worked for me several times.
Step 1- Change the launch option to Nothing.
Step 2- Run the app. It will launch the app but no activity will be displayed.
Step 3- Clean the project, uninstall from the device(optional)
, and again change the configuration to Default Activity. And invalidate Cache and Restart.
Upvotes: 1
Reputation: 11
Try adding <category android:name="android.intent.category.DEFAULT"/>
to the first <intent-filter>
tag
Upvotes: 0