Tag <manifest> attribute package has invalid character ' ' Android Manifest

11,672

Solution 1

Remove space from package name :

package="com.exampl e.harounsmida.test2"

After removing space :

package="com.example.harounsmida.test2"

Solution 2

Please consider gradle file and see what you have given as applicationId, any name that you have given in applicationId will be copied from gradle file and pasted to manifest

Also see for space and extra character in package's value

Solution 3

For those who still can't solve this problem :

1 - Close Android Studio.
2 - Browse to your project directory.
3 - Rename the project directory name to something else.
4 - Open Android Studio and open your project (browse to the renamed directory) .
5 - Select Build --> Edit Flavors --> Type something like yourname.myapplication in application id textbox (avoid using non English characters or space)
Image
6 - Select Build --> Rebuild Project and you are good to go.

Share:
11,672
Haroun SMIDA
Author by

Haroun SMIDA

Determined, passionate, hard working individual with unyielding self motivation. 3+ years of C++ and 2+ years of Java programming experience combined with a passion for mobile development and the industry. Know for good teamwork and leadership skills. Tenacious problem-solver with a strong work ethic. Willing to relocate anywhere

Updated on June 05, 2022

Comments

  • Haroun SMIDA
    Haroun SMIDA almost 2 years

    I am getting the error "Tag attribute package has invalid character ' '." in the Android Manifest, while there is no obviously invalid character. Here is the code:

        <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.exampl e.harounsmida.test2"
            android:versionCode="1"
            android:versionName="1.0" >
    
            <uses-sdk
                android:minSdkVersion="15"
                android:targetSdkVersion="22" />
    
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    
            <application
                android:name="com.example.harounsmida.test2.app.AppController"
                android:allowBackup="true"
                android:icon="@mipmap/ic_launcher"
                android:label="@string/app_name"
                android:theme="@style/AppTheme" >
                <activity
                    android:name="com.example.harounsmida.test2.LoginActivity"
                    android:label="@string/app_name"
                    android:launchMode="singleTop"
                    android:windowSoftInputMode="adjustPan" >
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
    
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
                <activity
                    android:name="com.example.harounsmida.test2.RegisterActivity"
                    android:label="@string/app_name"
                    android:launchMode="singleTop"
                    android:windowSoftInputMode="adjustPan" />
                <activity
                    android:name="com.example.harounsmida.test2.MainActivity"
                    android:label="@string/app_name"
                    android:launchMode="singleTop" />
                <activity
                    android:name="com.example.harounsmida.test2.UploadToServerActivity"
                    android:label="@string/app_name"
                    android:launchMode="singleTop" />
            </application>
    
        </manifest>
    

    I don't understand where is the problem, Android Studio says that "File under the build folder are generated and should not be edited." although I didn't edit it.

  • Haroun SMIDA
    Haroun SMIDA over 8 years
    Oh i didn't see at all, thanks a lot man, it gave me a lot of troubles
  • Haroun SMIDA
    Haroun SMIDA over 8 years
    The problem is when I remove the space from the package name and rebuild the project, it come back again with the same error and the space is still there.
  • Ashish
    Ashish about 8 years
    @HarounSMIDA I have the same problem, how did you solve it?
  • Haroun SMIDA
    Haroun SMIDA about 8 years
    As you can see, There was a mistake in package name, an extra space
  • jkdev
    jkdev over 7 years
    This looks like an answer to me. (It was automatically flagged by the system as potentially low-quality.) But it could be revised to make it more clear.