Android Studio Cannot resolve symbol 'MainActivity in Android Manifest.xml - java

I am not sure if I caused this error by re-nameing an older working directory to use as a new application, but my application does not launch. Maybe its best just to build new that copy? The problem seemed to have started when I copied in some new java code, but that code seems to run fine.
I get the following error when trying to launch the emulator: Could not identify launch activity: Default Activity not found Error while Launching activity
Now I also notice I have the following error in AndroidManifest.xml. Cannot resolve symbol 'MainActivity in AndroidManifest.xml
I have read other posts that state to Invalidate the Cache are restart, but that does not fix my problem.
Below is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nettools">
<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>
Here is the AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.NetTools">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="NetTools"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="com.example.android.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

You are using relative reference to MainActivity (note . (dot) at the beginning). The reference should be relative to package. So make sure that your MainActivity class is located under package com.example.android.nettools
It must be reachable at location com.example.android.nettools.MainActivity

Related

Error while creating uses-permission from a package

I am trying to create an android application that bluetooth connects to a third party device and saves the data collected into a database. The problem I am currently having is adding the uses-permission for broadcasting and reading the data from a package. my code is as follows in android manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.daotec.bgextract">
<uses-permission android:name="com.b3inc.sbir.mdrs.permission.READ_DATA”/>
<uses-permission android:name="com.b3inc.sbir.mdrs.permission.BROADCAST"/>
<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=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
after i placed in the READ DATA permission i got errors all throughout my xml file and the broadcast permission has an error Attribute is missing the Android namespace prefix. When i run the application i am getting error The value of attribute "android:name" associated with an element type "uses-permission" must not contain the '<' character.
I think you have copied this line <uses-permission android:name="com.b3inc.sbir.mdrs.permission.READ_DATA”/>, Try to replace the double quotes "
After ...permission.READ_DATA, you have a formatted quote - ”. Replace it with the appropriate quote - ".
Hello try out below code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.daotec.bgextract">
<uses-permission android:name="com.b3inc.sbir.mdrs.permission.READ_DATA" />
<uses-permission android:name="com.b3inc.sbir.mdrs.permission.BROADCAST" />
<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=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Replace below line then your issue solved.
<uses-permission android:name="com.b3inc.sbir.mdrs.permission.READ_DATA" />
Issue is Replace ” with "

no resource identifier found for attribute 'launchmode' in package android

This is my AndroidManifiest.xml File
Their is 2 error
no resource identifier found for attribute 'launchmode' in package android
no resource identifier found for attribute 'stateNotNeeded' in package android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="a52.puri.fbkunal.com.launcher">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:
>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>
</manifest>
You are assigning unknown property for application tag, launchMode in android is for Activities. Activities launch and visible to user but Application launch only once when you start your App. You can say Application is a start point in Android App.
Assign a launchMode into Activity not in application tag.
Basically we could assign a launchMode directly as an attribute of <activity> tag inside AndroidManifest.xml file list this:
<activity
android:name=".SingleTaskActivity"
android:label="singleTask launchMode"
android:launchMode="singleTask">

Problems with Android Manifest file

Here is the Code, I keep getting errors with what I believe is syntax, but I'm not able to fix, I'm new to android development and I need to complete this project by next week, if there's a resource someone could direct me towards to help solve this problem that would be great!
(android studio specifically is telling me multiple root tags, tag name expected,tag start was not closed, and unexpected end of file)
EDIT: sorry about formatting I think I fixed it
EDIT2: I've narrowed it down to just one multiple root tag, still unsure of how to solve problem
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="shake.shake"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainPage">
<intent-filter>
<action
android:name="android.intent.action.MAIN"
/>
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="shake.shake.ShakePage"
android:label="#string/title_activity_shake_page"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/FullscreenTheme"
android:parentActivityName="shake.shake.MainPage">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="shake.shake.MainPage" />
</activity>
</application>
You have excluded <application> from <manifest> tag.
The <application> must reside within <manifest> tag (parent).
<manifest>
<application>
...
</application>
</manifest>
< Original<?xml version="1.0" encoding="utf-8"?>
It seems to me that this line has no end tag to be found throughout the codes that you provide up there.. hehe.. not sure whether it is this ;)
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="shake.shake">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainPage">
<intent-filter>
<action
android:name="android.intent.action.MAIN"
/>
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="shake.shake.ShakePage"
android:label="#string/title_activity_shake_page"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/FullscreenTheme"
android:parentActivityName="shake.shake.MainPage">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="shake.shake.MainPage" />
</activity>
</application>
</manifest>
How about trying this
Just try to get the meta-data tag out from here and put it under the closing activity tag and see. For instance;
<activity
android:name="shake.shake.ShakePage"
android:label="#string/title_activity_shake_page"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/FullscreenTheme"
android:parentActivityName="shake.shake.MainPage">
</activity>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="shake.shake.MainPage" />

Android Studio states [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

I'm not quite sure how I would go about fixing this manifest. I have one activity with one fragment for reference, and this is just the manifest that was generated by Android Studio.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Enayet.minigma" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The android documentation states that package names can contain both upper case and lower case letters, however, this issue seems to occur when using upper case. Try changing your package name to
enayet.minigma

Launcher activity not starting first

The title explains it pretty much, here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.craym.vulcrum.firstgametnb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StartingPoint"
android:label="#string/app_name" >
<intent-filter>
<action android:name="eu.craym.vulcrum.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Yet whenever I run this application, the StartingPoint classed is called first:
[2013-03-09 18:36:40 - FirstGameTNB] Starting activity eu.craym.vulcrum.firstgametnb.StartingPoint on device emulator-5554
Why is this happening? I thought the MAIN and LAUNCHER were supposed to make it so the Splash class gets called first, but this never happens. Note that when I delete the StartingPoint activity, it goes to Splash.
You're right. You may try a clean on your project.
android.intent.action.MAIN: Start as a main entry point, does not
expect to receive data.
Source

Categories