Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android manifest attribute not allowed here

I have several manifest errors regarding some attributes . I have not made any changes to the manifest the application generated automatically yet i get several errors. *( I'm using Android Studio 1.2.2)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.iustinian.girlfriendsolver"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="22" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.iustinian.girlfriendsolver.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>
    </application>

</manifest>

-For the xmlns:android attribute i get "URL not registered " -For android versionCode , versionName , allowBackup , label and theme I get "attribute not allowed here "

I took a look at the manifest documentation and couldn't find an answer . For example the allowBackup attribute is placed exactly like the documentation specifies .

Edit: after looking around some more I found that at android:theme "@style/AppTheme" I get a no resource matches the given name . This is the only thing that shows up in the Gradle Build . I have cleaned and rebuilt the project several times .

like image 787
Iustinian Olaru Avatar asked Jul 28 '15 17:07

Iustinian Olaru


People also ask

What is permissions in manifest?

Allows applications to access information about networks. Marker permission for applications that wish to access notification policy. Allows applications to access information about Wi-Fi networks.

What does manifest mean in Android?

The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.


5 Answers

Just Close your manifest file and reopen it. It worked for me.

like image 99
rajlaxmi_jagdale Avatar answered Oct 10 '22 03:10

rajlaxmi_jagdale


In my case, closing the AndroidManifest.xml AND choosing File > Invalidate Caches / Restart solved the issue.

Not sure why I had to do the last step as well but it sorted out all those errors for me.

like image 21
lundzern Avatar answered Oct 10 '22 03:10

lundzern


Close AndroidManifest — File — Sync Project with Gradle Files. It helped.

P.S. A few months later I met this problem again — googled — found this answer and it didn't help! :D But this time I removed the Android Studio and installed the beta version. It helped.

like image 36
Anna Avatar answered Oct 10 '22 04:10

Anna


For your "attribute not allowed here" problem, versionCode, versionName and allowBackup have to be placed in the build.gradle file and not in the Android Manifest. That should solve the problem.

Secondly, for your "@style/AppTheme no resource matches the given name" problem, you will have to check your styles.xml file and make sure that a style with the name AppTheme exists over there.

Hope this helps you or anyone who views this answer.

like image 4
Anas Imran Tasadduq Avatar answered Oct 10 '22 05:10

Anas Imran Tasadduq


In Android Studio just close the Manifest file and open it again. It will solve the issue. By the way Studio gives too many stupid errors like this.

like image 4
Hammad Khan Avatar answered Oct 10 '22 03:10

Hammad Khan