The activity 'MainActivity' is not declared in AndroidManifest.xmlNo IDEA annotations attached to the JDK 1.8 (C:…), some issues will not be foundActivity Declaration in AndroidManifest.xmlAndroid studio - MainActivity not declared over and overHow to save an Android Activity state using save instance state?Activity restart on rotation AndroidStrange out of memory issue while loading an image to a Bitmap objectHow to declare global variables in Android?Fling gesture detection on grid layoutStop EditText from gaining focus at Activity startupExample: Communication between Activity and Service using MessagingfindViewById in FragmentYou need to use a Theme.AppCompat theme (or descendant) with this activityThis Activity already has an action bar supplied by the window decor
Erratic behavior by an internal employee against an external employee
Capacitors with a "/" on schematic
How quickly could a country build a tall concrete wall around a city?
Word or idiom defining something barely functional
Where to pee in London?
What is the German idiom or expression for when someone is being hypocritical against their own teachings?
How can I make Ubuntu run well (including with wifi) on a 32-bit machine?
Short story about a teenager who has his brain replaced with a microchip (Psychological Horror)
In the movie Harry Potter and the Order or the Phoenix, why didn't Mr. Filch succeed to open the Room of Requirement if it's what he needed?
What does Fisher mean by this quote?
Need help understanding lens reach
Finish the Mastermind
Using Select on Dataset with missing keys
Is it allowed and safe to carry a passenger / non-pilot in the front seat of a small general aviation airplane?
What are these mathematical groups in U.S. universities?
Why is there a need to prevent a racist, sexist, or otherwise bigoted vendor from discriminating who they sell to?
Decode a variable-length quantity
Is this cheap "air conditioner" able to cool a room?
Did Apollo leave poop on the moon?
Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?
How can glass marbles naturally occur in a desert?
Unexpected route on a flight from USA to Europe
Will a paper be retracted if a flaw in released software code invalidates its central idea?
If there were no space agencies, could a person go to space?
The activity 'MainActivity' is not declared in AndroidManifest.xml
No IDEA annotations attached to the JDK 1.8 (C:…), some issues will not be foundActivity Declaration in AndroidManifest.xmlAndroid studio - MainActivity not declared over and overHow to save an Android Activity state using save instance state?Activity restart on rotation AndroidStrange out of memory issue while loading an image to a Bitmap objectHow to declare global variables in Android?Fling gesture detection on grid layoutStop EditText from gaining focus at Activity startupExample: Communication between Activity and Service using MessagingfindViewById in FragmentYou need to use a Theme.AppCompat theme (or descendant) with this activityThis Activity already has an action bar supplied by the window decor
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am getting an error which reads The activity 'MainActivity' is not declared in AndroidManifest.xml
What is the problem here?
android xml
|
show 1 more comment
I am getting an error which reads The activity 'MainActivity' is not declared in AndroidManifest.xml
What is the problem here?
android xml
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
1
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25
|
show 1 more comment
I am getting an error which reads The activity 'MainActivity' is not declared in AndroidManifest.xml
What is the problem here?
android xml
I am getting an error which reads The activity 'MainActivity' is not declared in AndroidManifest.xml
What is the problem here?
android xml
android xml
edited Oct 21 '16 at 20:45
Robin Daugherty
4,1831 gold badge30 silver badges44 bronze badges
4,1831 gold badge30 silver badges44 bronze badges
asked Oct 21 '16 at 18:57
Jodhvir SinghJodhvir Singh
161 gold badge1 silver badge2 bronze badges
161 gold badge1 silver badge2 bronze badges
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
1
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25
|
show 1 more comment
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
1
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
1
1
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25
|
show 1 more comment
12 Answers
12
active
oldest
votes
I got this error when moving a lot of files, to fix just resync your gradle files.
File->Sync Project with Gradle Files
add a comment |
Sometimes when moving or renaming files, you can have broken XML files. My case that the ic_launcher.xml was corrupt. I regenerated that and worked just fine.
Check every XML in your proyect.
add a comment |
You are most likely just missing the below from your AndroidManifest
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Here is a full example of an AndroidManifest
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pejner.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
add a comment |
Try to go to File->Invalidate Caches / Restard and choose invaliadate and restart ,it worked for me
add a comment |
This can be only two reason,
the bold one, missing extend statement
class MainActvity extends AppCompatActivity
or
you are using a wrong package name to register your activity so just in this case use ALT+Space then studio will show the options itself.
add a comment |
replace in your AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.justjava">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
add a comment |
You should try this
<activity
android:name="com.example.stockquote.StockInfoActivity"
android:label="@string/app_name"
/>
For more detail you can check hereActivity declare
add a comment |
Thanks everyone for taking the time out to help a beginner.
I found out that I had somehow misspelled the Package in MainActivity.java
When I corrected it the error was gone.
Thank you all.
add a comment |
I was getting an error "The activity 'MainActivity' is not declared in AndroidManifest.xml", even though it was correct in the manifest file.
My problem was that when I created the project I had to mark the item "Use AndroidX artifacts".
add a comment |
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
add a comment |
All of my XML file were cut in half for some reason, I'm not sure when it happened (I use Git VCS, so maybe that). I had to go through each of them and restore the code.
add a comment |
It have three ways to resolve
1:-
Go File->Invalidate Caches / choose invalidate and restart ,it works
2:-
If you make MainActivity
make sure you have onCreate
method in it and extend with AppCompatActivity
.
3:- And last option sync project with Gradle file
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%2f40183700%2fthe-activity-mainactivity-is-not-declared-in-androidmanifest-xml%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got this error when moving a lot of files, to fix just resync your gradle files.
File->Sync Project with Gradle Files
add a comment |
I got this error when moving a lot of files, to fix just resync your gradle files.
File->Sync Project with Gradle Files
add a comment |
I got this error when moving a lot of files, to fix just resync your gradle files.
File->Sync Project with Gradle Files
I got this error when moving a lot of files, to fix just resync your gradle files.
File->Sync Project with Gradle Files
answered Mar 20 at 17:40
MRDJR97MRDJR97
3412 gold badges5 silver badges15 bronze badges
3412 gold badges5 silver badges15 bronze badges
add a comment |
add a comment |
Sometimes when moving or renaming files, you can have broken XML files. My case that the ic_launcher.xml was corrupt. I regenerated that and worked just fine.
Check every XML in your proyect.
add a comment |
Sometimes when moving or renaming files, you can have broken XML files. My case that the ic_launcher.xml was corrupt. I regenerated that and worked just fine.
Check every XML in your proyect.
add a comment |
Sometimes when moving or renaming files, you can have broken XML files. My case that the ic_launcher.xml was corrupt. I regenerated that and worked just fine.
Check every XML in your proyect.
Sometimes when moving or renaming files, you can have broken XML files. My case that the ic_launcher.xml was corrupt. I regenerated that and worked just fine.
Check every XML in your proyect.
answered Nov 29 '18 at 23:10
Mariano LMariano L
5591 gold badge7 silver badges29 bronze badges
5591 gold badge7 silver badges29 bronze badges
add a comment |
add a comment |
You are most likely just missing the below from your AndroidManifest
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Here is a full example of an AndroidManifest
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pejner.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
add a comment |
You are most likely just missing the below from your AndroidManifest
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Here is a full example of an AndroidManifest
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pejner.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
add a comment |
You are most likely just missing the below from your AndroidManifest
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Here is a full example of an AndroidManifest
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pejner.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
You are most likely just missing the below from your AndroidManifest
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Here is a full example of an AndroidManifest
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pejner.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
answered Oct 21 '16 at 19:05
PradPrad
4757 silver badges15 bronze badges
4757 silver badges15 bronze badges
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
add a comment |
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
I used your code and the error still persists. Plz tell if you need any other file code.
– Jodhvir Singh
Oct 22 '16 at 6:13
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
Could you update your answer and show me the manifest?
– Prad
Oct 22 '16 at 10:58
add a comment |
Try to go to File->Invalidate Caches / Restard and choose invaliadate and restart ,it worked for me
add a comment |
Try to go to File->Invalidate Caches / Restard and choose invaliadate and restart ,it worked for me
add a comment |
Try to go to File->Invalidate Caches / Restard and choose invaliadate and restart ,it worked for me
Try to go to File->Invalidate Caches / Restard and choose invaliadate and restart ,it worked for me
answered Dec 17 '18 at 17:59
Lucian GabrielLucian Gabriel
135 bronze badges
135 bronze badges
add a comment |
add a comment |
This can be only two reason,
the bold one, missing extend statement
class MainActvity extends AppCompatActivity
or
you are using a wrong package name to register your activity so just in this case use ALT+Space then studio will show the options itself.
add a comment |
This can be only two reason,
the bold one, missing extend statement
class MainActvity extends AppCompatActivity
or
you are using a wrong package name to register your activity so just in this case use ALT+Space then studio will show the options itself.
add a comment |
This can be only two reason,
the bold one, missing extend statement
class MainActvity extends AppCompatActivity
or
you are using a wrong package name to register your activity so just in this case use ALT+Space then studio will show the options itself.
This can be only two reason,
the bold one, missing extend statement
class MainActvity extends AppCompatActivity
or
you are using a wrong package name to register your activity so just in this case use ALT+Space then studio will show the options itself.
edited Jan 13 at 12:00
Andre Batista
962 silver badges9 bronze badges
962 silver badges9 bronze badges
answered Oct 21 '16 at 19:00
Pavneet_SinghPavneet_Singh
27.6k5 gold badges29 silver badges46 bronze badges
27.6k5 gold badges29 silver badges46 bronze badges
add a comment |
add a comment |
replace in your AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.justjava">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
add a comment |
replace in your AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.justjava">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
add a comment |
replace in your AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.justjava">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
replace in your AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.justjava">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
answered Oct 21 '16 at 19:03
meladandroidmeladandroid
291 silver badge8 bronze badges
291 silver badge8 bronze badges
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
add a comment |
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
I used this code and the error still persists
– Jodhvir Singh
Oct 22 '16 at 6:13
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
please edit your question and show us the main activity
– meladandroid
Oct 22 '16 at 11:06
add a comment |
You should try this
<activity
android:name="com.example.stockquote.StockInfoActivity"
android:label="@string/app_name"
/>
For more detail you can check hereActivity declare
add a comment |
You should try this
<activity
android:name="com.example.stockquote.StockInfoActivity"
android:label="@string/app_name"
/>
For more detail you can check hereActivity declare
add a comment |
You should try this
<activity
android:name="com.example.stockquote.StockInfoActivity"
android:label="@string/app_name"
/>
For more detail you can check hereActivity declare
You should try this
<activity
android:name="com.example.stockquote.StockInfoActivity"
android:label="@string/app_name"
/>
For more detail you can check hereActivity declare
edited May 23 '17 at 12:31
Community♦
11 silver badge
11 silver badge
answered Oct 21 '16 at 19:09
Aby NavAby Nav
1
1
add a comment |
add a comment |
Thanks everyone for taking the time out to help a beginner.
I found out that I had somehow misspelled the Package in MainActivity.java
When I corrected it the error was gone.
Thank you all.
add a comment |
Thanks everyone for taking the time out to help a beginner.
I found out that I had somehow misspelled the Package in MainActivity.java
When I corrected it the error was gone.
Thank you all.
add a comment |
Thanks everyone for taking the time out to help a beginner.
I found out that I had somehow misspelled the Package in MainActivity.java
When I corrected it the error was gone.
Thank you all.
Thanks everyone for taking the time out to help a beginner.
I found out that I had somehow misspelled the Package in MainActivity.java
When I corrected it the error was gone.
Thank you all.
answered Oct 22 '16 at 7:15
Jodhvir SinghJodhvir Singh
161 gold badge1 silver badge2 bronze badges
161 gold badge1 silver badge2 bronze badges
add a comment |
add a comment |
I was getting an error "The activity 'MainActivity' is not declared in AndroidManifest.xml", even though it was correct in the manifest file.
My problem was that when I created the project I had to mark the item "Use AndroidX artifacts".
add a comment |
I was getting an error "The activity 'MainActivity' is not declared in AndroidManifest.xml", even though it was correct in the manifest file.
My problem was that when I created the project I had to mark the item "Use AndroidX artifacts".
add a comment |
I was getting an error "The activity 'MainActivity' is not declared in AndroidManifest.xml", even though it was correct in the manifest file.
My problem was that when I created the project I had to mark the item "Use AndroidX artifacts".
I was getting an error "The activity 'MainActivity' is not declared in AndroidManifest.xml", even though it was correct in the manifest file.
My problem was that when I created the project I had to mark the item "Use AndroidX artifacts".
answered Feb 24 at 10:02
KseniyaKseniya
1
1
add a comment |
add a comment |
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
add a comment |
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
add a comment |
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
answered Mar 27 at 5:54
ZubairZubair
15 bronze badges
15 bronze badges
add a comment |
add a comment |
All of my XML file were cut in half for some reason, I'm not sure when it happened (I use Git VCS, so maybe that). I had to go through each of them and restore the code.
add a comment |
All of my XML file were cut in half for some reason, I'm not sure when it happened (I use Git VCS, so maybe that). I had to go through each of them and restore the code.
add a comment |
All of my XML file were cut in half for some reason, I'm not sure when it happened (I use Git VCS, so maybe that). I had to go through each of them and restore the code.
All of my XML file were cut in half for some reason, I'm not sure when it happened (I use Git VCS, so maybe that). I had to go through each of them and restore the code.
answered Apr 11 at 9:06
sp00kysp00ky
468 bronze badges
468 bronze badges
add a comment |
add a comment |
It have three ways to resolve
1:-
Go File->Invalidate Caches / choose invalidate and restart ,it works
2:-
If you make MainActivity
make sure you have onCreate
method in it and extend with AppCompatActivity
.
3:- And last option sync project with Gradle file
add a comment |
It have three ways to resolve
1:-
Go File->Invalidate Caches / choose invalidate and restart ,it works
2:-
If you make MainActivity
make sure you have onCreate
method in it and extend with AppCompatActivity
.
3:- And last option sync project with Gradle file
add a comment |
It have three ways to resolve
1:-
Go File->Invalidate Caches / choose invalidate and restart ,it works
2:-
If you make MainActivity
make sure you have onCreate
method in it and extend with AppCompatActivity
.
3:- And last option sync project with Gradle file
It have three ways to resolve
1:-
Go File->Invalidate Caches / choose invalidate and restart ,it works
2:-
If you make MainActivity
make sure you have onCreate
method in it and extend with AppCompatActivity
.
3:- And last option sync project with Gradle file
answered Apr 11 at 9:11
AhmadAhmad
1401 silver badge11 bronze badges
1401 silver badge11 bronze badges
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%2f40183700%2fthe-activity-mainactivity-is-not-declared-in-androidmanifest-xml%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
From the screenshot, because the activity is red, I would guess you have it in the wrong package. Can you share a screenshot of your main activity?
– Francesc
Oct 21 '16 at 19:01
is there a whitespace before ".MainActivity" ? It looks like there is one before the point(.)...
– Opiatefuchs
Oct 21 '16 at 19:02
Please don't post screenshots of code.
– BSMP
Oct 21 '16 at 19:03
Can you please put the log and your AndroidManifest.xml code here?
– Sourabh
Oct 22 '16 at 10:32
1
stackoverflow.com/questions/50740240/… this is how it worked for me.
– Muhammad Ahmed
Jan 2 at 15:25