Error:Cannot read packageName from app/src/main/AndroidManifest.xml - android

These are the errors that pop up when running my app for splash screen.
Error:The markup in the document preceding the root element must be well-formed.
Error:Cannot read packageName from /Users/akellavamsimeher/AndroidStudioProjects/WILM/app/src/main/AndroidManifest.xml
I tried to resolve seeing posts from stackoverflow but I'm still stuck at that. Please help me fix these errors.
Here is the code.
<?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pratyuvamgmail.wilm">
<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">
android:name="com.pratyuvamgmail.wilm.Splash" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action
android:name="com.coderefer.androidsplashscreenexample.MAINACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
Below is my code...
<?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pratyuvamgmail.wilm">
<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">
android:name="com.pratyuvamgmail.wilm.Splash" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.coderefer.androidsplashscreenexample.MAINACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>

First impression is that you manifest file (src/main/AndroidManifest.xml) does not start like follows:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.name" >
...
</manifest>
Or it has a invalid format...
Share your manifest file and then, we will be able to see exact error

Answer from here is checking that the applicationId is set in the defaultConfig in build.gradle ,
because the applicationId in build.gradle overrides the package in <manifest>.

Your manifest is wrong, you have duplicate the tag close manifest and some tags have wrong open/close tags.
A simple example could be:
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application>
<activity>
<intent-filter>
<action />
<category />
<data />
</intent-filter>
<meta-data />
</activity>
<activity-alias>
<intent-filter> . . . </intent-filter>
<meta-data />
</activity-alias>
<service>
<intent-filter> . . . </intent-filter>
<meta-data/>
</service>
<receiver>
<intent-filter> . . . </intent-filter>
<meta-data />
</receiver>
<provider>
<grant-uri-permission />
<meta-data />
<path-permission />
</provider>
<uses-library />
</application>
</manifest>
Check android documentation for more info:
https://developer.android.com/guide/topics/manifest/manifest-intro.html
Check if works this code for you:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pratyuvamgmail.wilm">
<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>

Related

intent-filter is not allowed?

I'm getting an "Element intent-filter is not allowed here" error. The instructions were to simply cut and paste the intent filter from WeatherActivity to MainMenuActivity since WeatherActivity was created first but it doesn't like it when I do it. What am I doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.introandroidapp">
<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/Theme.IntroAndroidApp">
<activity
android:name=".MyDrawing"
android:exported="false" />
<activity
android:name=".MainMenuActivity"
android:exported="false" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity
android:name=".WeatherActivity"
android:exported="true">
</activity>
</application>
</manifest>
<intent-filter> should be inside activity tag. If you want to mark MainMenuActivity as main, try something like this:
<activity
android:name=".MainMenuActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Don't forget that the main activity should have exported="true".

Couldn't identify launch Activity: Default Activity not found (I'm using Kotlin)

I can't open the app on my phone because it says it doesn't have a launch activity so I can open it.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.frases.coquinha">
<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/Theme.Coquinha">
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".tela2"
android:exported="false" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
You do not have a suitable <intent-filter> for that on either of your <activity> elements.
You need this <intent-filter> in whichever of your <activity> elements represents your launcher activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
And, you would need to switch to android:exported="true" for that <activity> element.

Why I am getting error with my activity in android?

I declare both of my activity class in AndroidManifest.xml file them when I run my application it stop unfortunately with this error message:-
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidtutorialpoint.androidobservablescrollview/com.androidtutorialpoint.androidobservablescrollview.ParallaxToolbarScrollViewActivity}; have you declared this activity in your AndroidManifest.xml?
This is my manifest file:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<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"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>
</application>
</manifest>
My Activity class names are:-
MainActivity
ParallaxToolbarScrollViewActivity
Clean your build and rebuild the project. If you are using instance run android studio feature then disable this for avoid this problem
You placed it in the wrong location it should be inside the application tag. All your <activity... /> tags should be placed under the <application.. /> tag.
Hope this helps!
Remove
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
otherwise change your package name insted of
com.androidtutorialpoint.androidobservablescrollview
Remove intent-filter tag from your second activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<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">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
</activity>
</application>
</manifest>
Put intent filter to single activity which you want to start first. If launching activity is MainActivity, then remove intent filter from ParallaxToolbarScrollViewActivity. Or recheck the category line **
"com.androidtutorialpoint.androidobservablescrollview"
**
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>

Android Studio - Can't find app icon on TV homescreen

When I install my app using a file explorer on my tv, I can run it and everything but I do not know how to create an icon that will sit on the home screen of the tv
Here is my AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sony.omgandroid" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It utilizes the android:banner in the AndroidManifest on the application tag.
<application
android:name=".ExampleApp"
android:banner="#drawable/app_banner"
android:theme="#style/AppTheme"
You need add in AndroidManifest.xml file
android:banner android:icon android:logo and android.intent.category.LEANBACK_LAUNCHER
example:
<activity
...
android:banner="#mipmap/ic_launcher"
android:icon="#mipmap/ic_launcher"
android:logo="#mipmap/ic_launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>

After app installation I can't open it

I have created an simple app with a few activities. After successful installation I can't open the app. I can just see it in device's apps.
Yes of course a read all the answers telling "You have to set launcher activity". But I set launcher activity.
Here is AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme">
</application>
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.SearchActivity"
android:label="#string/search_activity">
</activity>
<activity
android:name=".activities.CustomerActivity"
android:label="#string/customer_activity">
</activity>
<activity
android:name=".activities.CreditActivity"
android:label="#string/credit_activity">
</activity>
<activity
android:name=".activities.PrintReceiptActivity"
android:label="#string/print_receipt_activity">
</activity>
<activity
android:name=".activities.ProductActivity"
android:label="#string/product_activity">
</activity>
Never before happened to me... Can you give me some advice? Thanks a lot
All your activities are required to be defined within the <application> tag.
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme">
<!-- Add activites here -->
</application>
Your manifest should look like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme">
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
...
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme">
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.SearchActivity"
android:label="#string/search_activity">
</activity>
<activity
android:name=".activities.CustomerActivity"
android:label="#string/customer_activity">
</activity>
<activity
android:name=".activities.CreditActivity"
android:label="#string/credit_activity">
</activity>
<activity
android:name=".activities.PrintReceiptActivity"
android:label="#string/print_receipt_activity">
</activity>
<activity
android:name=".activities.ProductActivity"
android:label="#string/product_activity">
</activity>
</application>
</manifest>
try Replacing your manifest with this..
Change your AndroidManifest.xml structure to -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme">
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.SearchActivity"
android:label="#string/search_activity">
</activity>
<activity
android:name=".activities.CustomerActivity"
android:label="#string/customer_activity">
</activity>
<activity
android:name=".activities.CreditActivity"
android:label="#string/credit_activity">
</activity>
<activity
android:name=".activities.PrintReceiptActivity"
android:label="#string/print_receipt_activity">
</activity>
<activity
android:name=".activities.ProductActivity"
android:label="#string/product_activity">
</activity>
</application>
</manifest>
All activities tag must be placed inside <application> tag and it should be placed inside <manifest> tag.

Categories

Resources