简体   繁体   中英

Error while fetching http://schemas.android.com/apk/res/android

Ok so I was going through a tutorial online, then when i tried to change my build.gradle file to compileSdkVersion 21 instead of 23 everything lost the plot and now all my previous projects etc are all showing errors.

In the AndroidManifest.xml the 2 http lines and all the android: are all red and the the activity opening tag has a red squiggly line under it also. I have zero idea what i have done wrong? Almost like internet has gone? Just a noob so i have no idea please help!

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:android="http://schemas.android.com/tools"
          package="com.site.project" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        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>

    </application>

</manifest>

This answer extends @adelphus' .

A new app\\build\\intermediates\\manifests\\full\\debug\\AndroidManifest.xml would have listed these errors. Close and reopen the AndroidManifest.xml file from the project pane under app > manifests .

Hope this works for you.

You have duplicate schema definitions for the xmlns:android namespace in your manifest file - only one schema per namespace is allowed and I suspect the compiler is getting confused by the duplicate entry.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:android="http://schemas.android.com/tools"
          package="com.site.project" >

should be:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.site.project" >

The namespace schema definitions are important - they are used to define attribute prefixes. Because your duplicate entry is invalidating the android namespace, all attributes prefixed with android: will be wrong - this is why all the android: attributes have an error (red line) displayed.

Alternatively, just remove the tools namespace completely if you're not using any attributes with the tools: prefix in your manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.site.project" >

you need download jdk here " https://www.oracle.com/technetwork/java/javase/downloads/index.html " then go to File > Project Structure > here you config path jdk default C:\\Program Files\\Java\\jdk-11.0.2 . Hope this works for you

I think you have two AndroidManifest.xml files to change it. Just rename the debug AndroidManifest.xml and that solution works for me.

Search for the AndroidManifest.xml file(s). on the project ParentPath. if there are multiple, keep one and delete the others.(usually find many other)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM