Problems with Android Manifest file - java

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" />

Related

Android Application Build Error: Manifest merger failed with multiple errors, see logs

I already build some other applications but in this time, I am facing an unfixable error. Please help me out.
In the error it show "Manifest merger failed with multiple errors, see logs". So, I'm giving my manifest.xml file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sharpwebtechnologies.photoviewer" >
<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.PhotoViewer"
tools:targetApi="31" >
<activity
android:name=".SplashScreen"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false" >
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>

XML document structures must start and end within the same entity?

What is the problem?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.4" >
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver android:name=".MainActivity"
tools:ignore="IntentFilterExportedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>
</application>
You need the closing </manifest> tag under the </application>:
(...)
</application>
</manifest>
Close the manifest tag after application tag.
</application></manifest>
android:icon="#drawable/ic_launcher" // check in drawable folder under res whether the default image ic_launcher is present or not. That is the default icon for your application.
You are missing </manifest> on the last line. It's also likely that android:icon="#drawable/ic_launcher" should be changed to android:icon="#mipmap/ic_launcher".
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.4" >
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

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

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

android "use $ instead of ." produce cannot resolve symbol

In my manifest. with the new SDK, it requires me to replace my android:name paths with the warning:
use $ instead of . for inner classes(or use only lowercase letters in package name)
This is one of my activities:
<activity
android:name=".Activities.LoginActivity" >
</activity>
and it suggest me to replace it with
<activity
android:name=".Activities$LoginActivity" >
</activity>
The problem is that this produce the following:
Cannot resolve symble Activities
So, what I have to do? I just ignore the alert or I have to replace it someway else?
EDIT:
here is the source of activities folder:
app.java.personal.pier.myapp.Activities
this is my entire manifest, I don't think it should be need but just in case it is here :)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="personal.pier.myapp" >
<uses-permission android:name="andorid.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="true" >
<activity
android:name=".Activities.SplashScreenActivity"
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=".Activities.LoginActivity" >
</activity>
<activity
android:name=".Activities.HomePageActivity" >
</activity>
<activity
android:name=".Activities.FoodAddActivity" >
</activity>
<activity
android:name=".Activities.FoodManagementActivity" >
</activity>
<activity
android:name=".Activities.FoodDetailsActivity" >
</activity>
<activity
android:name=".Activities.EatingSuntActivity" >
</activity>
<activity
android:name=".Activities.EatingDetailsActivity" >
</activity>
<activity
android:name=".Activities.EatingAddActivity" >
</activity>
<activity android:name=".Activities.SportAddActivity" >
</activity>
</application>
</manifest>
The most likely problem appeared because you are using upper case in your package name.

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

Categories