How can I solve these errors in AndroidManifest.xml? - android

I have changed something manually in my android manifest in one of the activities and now many lines of my manifest are in red
I have errors like "Uri is not registered", "Attribute is not allowed here", etc.
This is the complete AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dogsgame"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="30" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<supports-gl-texture android:name="GL_OES_compressed_paletted_texture" />
<application
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="#style/Theme.Dogsgame" >
<activity android:name="com.example.dogsgame.shop" />
<activity
android:name="com.example.dogsgame.backdog"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.dogoutside"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.dog"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.choosedogs"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.secondactivity"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.MainActivity"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</application>

you closed the MainActivity without the intent-filter
this is the solution
<activity
android:name="com.example.dogsgame.MainActivity"
android:theme="#style/Theme.AppCompat.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Related

How can I solve error: unexpected element <intent-filter> found in <manifest><application>

I have an error in my Android Manifest.xml
I don't know what do I have modified.
I wanted to make the main activity with theme Theme.NoActionBar but something has been deconfigured.
It throws the following error: unexpected element found in . .
This is my android manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dogsgame"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="30" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<supports-gl-texture android:name="GL_OES_compressed_paletted_texture" />
<application
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="#style/Theme.Dogsgame" >
<activity android:name="com.example.dogsgame.shop" />
<activity
android:name="com.example.dogsgame.backdog"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.dogoutside"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.dog"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.choosedogs"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.secondactivity"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.example.dogsgame.MainActivity"
android:theme="#style/Theme.AppCompat.NoActionBar" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</application>
You should change it like
...
<activity
android:name="com.example.dogsgame.MainActivity"
android:theme="#style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

The value of attribute "android:name" associated with an element type "null" must not contain the '<' character

Extreme novice here tying to figure this error out.
The value of attribute "android:name" associated with an element type "null" must not contain the '<' character
This is generated by something I have created with the addition of the android.hardware.usb.jar I have included as a library I believe. I can't identify what/which target is "null"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nitro"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="18" />
<uses-feature
android:name="android.hardware.usb/>
<application
android:allowBackup="android:false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
<uses-library android:name="android:android.hardware.usb" />
<android-required ="android:true " />
<activity android:name="com.nitro.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
<intent-filter
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER />
</intent-filter>
<intent-filter
<action android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/acccessory_filter" />
</activity>
</application>
</manifest>
I am still building and learning. This is just a hobby at this point so go easy on me, this is all out of my comfort zone and I will need detailed explanation.
Thanks
Kyle
<uses-feature
android:name="android.hardware.usb/>
You haven't closed the quote, it should be:
<uses-feature
android:name="android.hardware.usb" />
You have also forgotten to close this quote:
<category android:name="android.intent.category.LAUNCHER />
Should be
<category android:name="android.intent.category.LAUNCHER" />
Also, your application tag is not closed and android:false is not valid:
<application
android:allowBackup="android:false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
Should be
<application
android:allowBackup="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
That is not correct:
<uses-library android:name="android:android.hardware.usb" />
<android-required ="android:true " />
As there is no standalone android-required tag, that is probably the android:required of the uses-library tag. Here you can read more on that. It should be like:
<uses-library android:name="android:android.hardware.usb" android:required ="true" />
Your intent-filter tag is not closed:
<intent-filter
It should be:
<intent-filter>
The whole manifest with all fixed bugs should be like this I believe:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nitro"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="18" />
<uses-feature android:name="android.hardware.usb" />
<application
android:allowBackup="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library
android:name="android:android.hardware.usb"
android:required="true" />
<activity
android:name="com.nitro.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/acccessory_filter" />
</activity>
</application>
</manifest>
I had the same error and checked the exact text and it was ok but still THE ERROR...
So I fixed copy pasting that line of the manifest (uses-sdk) from another Manifest of a working project and build it nicely!
Hope it helps!
android:name="android.hardware.usb/>need closing quote
android:name="android.hardware.usb"/>
here try this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nitro"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="18" />
<uses-feature
android:name="android.hardware.usb"/>
<application
android:allowBackup="android:false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<uses-library android:name="android:android.hardware.usb" />
<android-required ="android:true " />
<activity android:name="com.nitro.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER />
</intent-filter>
<intent-filter>
<action android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/acccessory_filter" />
</activity>
</application>
</manifest>

The <activity> element must be a direct child of the <application> element

I just wanted to launch my application, but it always fails and gives me this error. Before, it would just install the .apk file, but now it just fails to start at all. I just began and was following the Android Developing tutorial.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
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="com.example.myfirstapp.MainActivity"
android:label="#string/app_name" >
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</meta-data>
</activity>
</activity>
</application>
</manifest>
You can't have nested activity tags inside your Manifest, fix this issue and it should work.
YES - for example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.SET_WALLPAPER"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.camera" />
<application
android:icon="#drawable/icon" android:label="#string/app_name">
<!-- Boot window -->
<activity
android:name=".ServicesDemo" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Second window -->
<activity android:name=".MainActivity" android:label="#string/app_name"
android:parentActivityName=".ServicesDemo" />
<!-- Second window -->
<activity android:name=".MyWall" android:label="#string/app_name"
android:parentActivityName=".ServicesDemo" />
<!-- Second window -->
<activity android:name=".MyRotations" android:label="#string/app_name"
android:parentActivityName=".ServicesDemo" />
<!-- Second window -->
<activity android:name=".MySetting" android:label="#string/app_name"
android:parentActivityName=".ServicesDemo" />
<receiver
android:enabled="true"
android:name=".IntentReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.HEADSET_PLUG" />
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.intent.action.SCREEN_OFF" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service android:enabled="true" android:name=".MyService" />
<service android:enabled="true" android:name=".MyNewpic" />
</application>
</manifest>
You don't nest Activities in other Activities. This is how it should look like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
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="com.example.myfirstapp.MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</meta-data>
</activity>
</application>
</manifest>
Do read the Android docs for the AndroidManifest.xml file

AndroidManifest.xml - The element must be a direct child of the <application> element error

I made a copy of one of my working projects for another project. Ever since I can't get the AndroidManifest.xml to work properly. I get the error The element must be a direct child of the <application> element or The element type "manifest" must be terminated by the matching end-tag "</manifest>"error. I have refactored everything else and don't see any errors in my classes. Just the xml file is being a pain. What is wrong with this file? It looks fine and looks like my working one. Eclipse seems to think there are errors.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package= "com.mydomain.qsd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.mydomain.qsd.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<permission
android:name="com.mydomain.qsd.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" />
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" />
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.mydomain.qsd" />
</intent-filter>
</receiver>
<service android:name="com.mydomain.qsd.gcm.GCMService"/>
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
</activity>
</application>
</manifest>
You have directly close your application tag
Replace this :
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" />
by this :
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
EDIT :
You have to replace this :
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"/>
by this :
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" >
This :
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" />
by this :
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" >
This :
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" />
by this:
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
And finally this :
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
</activity>
by this :
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
Your application Tag and also Activity tags have self close so remove that
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" /> <----- remove /

Error when installing android application

I trying to use C2DM in my android application, but after I added it I can't install the application. I get this error "Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED". But I can't see whats wrong.
Anyone that know what I have done wrong?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Wordy.Game"
android:versionCode="1"
android:versionName="0.1"
android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="Wordy.Game.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission
android:name="Wordy.Game.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application android:label="#string/app_name" android:icon="#drawable/wordy">
<activity android:name="Main"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="Wordy.Game" />
</intent-filter>
</receiver>
<receiver
android:name=".C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="Wordy.Game" />
</intent-filter>
</receiver>
<activity android:name="Result" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="PlayField" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="Game" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="News" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="PlayOnline" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="UsersOnline" android:label="#string/app_name" android:screenOrientation="portrait" />
</application>
</manifest>
I finally found whats wrong, the package name on the application was not allowed to start with capital letter.
try prefixing your activityies with a . or the full package name:
<activity android:name="com.gizm0.YourClass"></activvity>
or
<activity android:name=".YourClass"></activvity>

Categories

Resources