Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.


2 Answers

Remove space from package name :

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

After removing space :

package="com.example.harounsmida.test2"
like image 200
Haresh Chhelana Avatar answered Dec 09 '25 15:12

Haresh Chhelana


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.

like image 45
Hamid Reza Avatar answered Dec 09 '25 17:12

Hamid Reza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!