Cant start App from Android Studio with neither Launch Option “Default” nor “Specific” Activity

Multi tool use
The problem occured "over night". One day, everything worked fine. I shut my computer down and started it back up on another day. However, without changing a thing, I tried to launch my App on the same virtual device I had before and somehow it wont launch because:
"Error running 'app'. Default Activity not found."
My manifest looks like this. Changed the package name and the two activities below (see comments below). The rest is exactly the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MyPackageName">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
</activity>
<activity android:name=".AnotherActivity" />
<activity android:name=".OneMoreActivity">
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="364e8b3f6acfddf9ad32bed8c1503bb762b19cd5" />
</application>
</manifest>
And normally my app would just start with the Login Activity. However, now it does not. I tried to "Invalidate Caches / Restart". Nothing changed. I restarted AS multiple times. Still, nothing.
Then I tried to change the Launch Options. Current Option was set to "Default Activity". So I tried to change it to a specific one. Namely, the LoginActivity. But then it tells me:
"Error running 'app'. The Activity 'LoginActivity' is not declared in AndroidManifest.xml."
It tells me its not declared, which it clearly is. Otherwise I wouldnt be able to choose it from the dropdown in the first place. I also tried to start on another Activity. "MainActivity". Still nothing.
What exactly am I doing wrong? Is there maybe a workaround where I can manuelly get the APK on my virtual device so that I can at least keep working?
Thanks!
EDIT:
I already tried deleting the .gradle-folder. Sadly didnt work.
I tried pushing it to git and cloning it again in another folder. Didnt work either.
EDIT:
WORKAROUND:
So far I've only been able to find a workaround.
Go to Run/Edit Configurations...
Go to General/Launch Options -> Launch: Nothing
Run as you normally would. Android Studio will build the project and install the application to your device, but wont launch it!!
Launch your app manually on your device.
Go to Run/Attach Debugger to Android Process.
Choose your app.
Obviously, thats a little bit of a hassle and might make debugging the start of an app more difficult. So Im still looking for an actual solution.


add a comment |
The problem occured "over night". One day, everything worked fine. I shut my computer down and started it back up on another day. However, without changing a thing, I tried to launch my App on the same virtual device I had before and somehow it wont launch because:
"Error running 'app'. Default Activity not found."
My manifest looks like this. Changed the package name and the two activities below (see comments below). The rest is exactly the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MyPackageName">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
</activity>
<activity android:name=".AnotherActivity" />
<activity android:name=".OneMoreActivity">
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="364e8b3f6acfddf9ad32bed8c1503bb762b19cd5" />
</application>
</manifest>
And normally my app would just start with the Login Activity. However, now it does not. I tried to "Invalidate Caches / Restart". Nothing changed. I restarted AS multiple times. Still, nothing.
Then I tried to change the Launch Options. Current Option was set to "Default Activity". So I tried to change it to a specific one. Namely, the LoginActivity. But then it tells me:
"Error running 'app'. The Activity 'LoginActivity' is not declared in AndroidManifest.xml."
It tells me its not declared, which it clearly is. Otherwise I wouldnt be able to choose it from the dropdown in the first place. I also tried to start on another Activity. "MainActivity". Still nothing.
What exactly am I doing wrong? Is there maybe a workaround where I can manuelly get the APK on my virtual device so that I can at least keep working?
Thanks!
EDIT:
I already tried deleting the .gradle-folder. Sadly didnt work.
I tried pushing it to git and cloning it again in another folder. Didnt work either.
EDIT:
WORKAROUND:
So far I've only been able to find a workaround.
Go to Run/Edit Configurations...
Go to General/Launch Options -> Launch: Nothing
Run as you normally would. Android Studio will build the project and install the application to your device, but wont launch it!!
Launch your app manually on your device.
Go to Run/Attach Debugger to Android Process.
Choose your app.
Obviously, thats a little bit of a hassle and might make debugging the start of an app more difficult. So Im still looking for an actual solution.


Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26
add a comment |
The problem occured "over night". One day, everything worked fine. I shut my computer down and started it back up on another day. However, without changing a thing, I tried to launch my App on the same virtual device I had before and somehow it wont launch because:
"Error running 'app'. Default Activity not found."
My manifest looks like this. Changed the package name and the two activities below (see comments below). The rest is exactly the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MyPackageName">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
</activity>
<activity android:name=".AnotherActivity" />
<activity android:name=".OneMoreActivity">
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="364e8b3f6acfddf9ad32bed8c1503bb762b19cd5" />
</application>
</manifest>
And normally my app would just start with the Login Activity. However, now it does not. I tried to "Invalidate Caches / Restart". Nothing changed. I restarted AS multiple times. Still, nothing.
Then I tried to change the Launch Options. Current Option was set to "Default Activity". So I tried to change it to a specific one. Namely, the LoginActivity. But then it tells me:
"Error running 'app'. The Activity 'LoginActivity' is not declared in AndroidManifest.xml."
It tells me its not declared, which it clearly is. Otherwise I wouldnt be able to choose it from the dropdown in the first place. I also tried to start on another Activity. "MainActivity". Still nothing.
What exactly am I doing wrong? Is there maybe a workaround where I can manuelly get the APK on my virtual device so that I can at least keep working?
Thanks!
EDIT:
I already tried deleting the .gradle-folder. Sadly didnt work.
I tried pushing it to git and cloning it again in another folder. Didnt work either.
EDIT:
WORKAROUND:
So far I've only been able to find a workaround.
Go to Run/Edit Configurations...
Go to General/Launch Options -> Launch: Nothing
Run as you normally would. Android Studio will build the project and install the application to your device, but wont launch it!!
Launch your app manually on your device.
Go to Run/Attach Debugger to Android Process.
Choose your app.
Obviously, thats a little bit of a hassle and might make debugging the start of an app more difficult. So Im still looking for an actual solution.


The problem occured "over night". One day, everything worked fine. I shut my computer down and started it back up on another day. However, without changing a thing, I tried to launch my App on the same virtual device I had before and somehow it wont launch because:
"Error running 'app'. Default Activity not found."
My manifest looks like this. Changed the package name and the two activities below (see comments below). The rest is exactly the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MyPackageName">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
</activity>
<activity android:name=".AnotherActivity" />
<activity android:name=".OneMoreActivity">
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="364e8b3f6acfddf9ad32bed8c1503bb762b19cd5" />
</application>
</manifest>
And normally my app would just start with the Login Activity. However, now it does not. I tried to "Invalidate Caches / Restart". Nothing changed. I restarted AS multiple times. Still, nothing.
Then I tried to change the Launch Options. Current Option was set to "Default Activity". So I tried to change it to a specific one. Namely, the LoginActivity. But then it tells me:
"Error running 'app'. The Activity 'LoginActivity' is not declared in AndroidManifest.xml."
It tells me its not declared, which it clearly is. Otherwise I wouldnt be able to choose it from the dropdown in the first place. I also tried to start on another Activity. "MainActivity". Still nothing.
What exactly am I doing wrong? Is there maybe a workaround where I can manuelly get the APK on my virtual device so that I can at least keep working?
Thanks!
EDIT:
I already tried deleting the .gradle-folder. Sadly didnt work.
I tried pushing it to git and cloning it again in another folder. Didnt work either.
EDIT:
WORKAROUND:
So far I've only been able to find a workaround.
Go to Run/Edit Configurations...
Go to General/Launch Options -> Launch: Nothing
Run as you normally would. Android Studio will build the project and install the application to your device, but wont launch it!!
Launch your app manually on your device.
Go to Run/Attach Debugger to Android Process.
Choose your app.
Obviously, thats a little bit of a hassle and might make debugging the start of an app more difficult. So Im still looking for an actual solution.




edited Dec 29 '18 at 21:05
Smogen
asked Dec 28 '18 at 11:58


SmogenSmogen
79113
79113
Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26
add a comment |
Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26
Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26
add a comment |
1 Answer
1
active
oldest
votes
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:UsersUserName.AndroidStudio3.2systemcaches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958255%2fcant-start-app-from-android-studio-with-neither-launch-option-default-nor-spe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:UsersUserName.AndroidStudio3.2systemcaches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
add a comment |
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:UsersUserName.AndroidStudio3.2systemcaches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
add a comment |
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:UsersUserName.AndroidStudio3.2systemcaches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:UsersUserName.AndroidStudio3.2systemcaches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
answered Jan 5 at 21:57


SmogenSmogen
79113
79113
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958255%2fcant-start-app-from-android-studio-with-neither-launch-option-default-nor-spe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
p1k,kq1F
Delete .gradle file and invalidate and restart android studio should solve your problem
– Aman Rawat
Dec 28 '18 at 12:05
I have same problem, I fix this problem by create new project and copy/pate your code into new one otherwise post on 'GitHub' clone to different machine
– Rahul Chokshi
Dec 28 '18 at 12:05
@Smogen can you share the entire manifest file, might be beneficial
– Nero
Dec 28 '18 at 12:42
@Nero I added the manifest. As I said, the only change I made before posting is renaming the package to "MyPackageName" and the two activities "AnotherActivity" and "OneMoreActivity". The others have the correct names.
– Smogen
Dec 29 '18 at 16:00
@Smogen please also share the entire code for the Login activity (from top which also includes your imports)
– Nero
Dec 29 '18 at 17:26