6

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>
charlotteg
  • 159
  • 1
  • 1
  • 12
  • 1
    Did you sync your project with gradle? – frogatto Nov 10 '15 at 21:11
  • Yes once i hit that then i get a million errors throughout the rest of my code, it starts saying it cant find any of my themes etc once i remove one thing it cant find it finds another etc the list goes on. – charlotteg Nov 10 '15 at 21:13
  • Seems your project can't be synced with gradle. Did log window show anything? – frogatto Nov 10 '15 at 21:15
  • I have even gone into the tutorials files and copied their correct code just incase and still getting errors throughout, its like a setting has changed or something. @HiI'mfrogatto – charlotteg Nov 10 '15 at 21:16
  • These errors are because of your project not being synced with Gradle. After a successful sync all of them will go away. – frogatto Nov 10 '15 at 21:18
  • The error from the Message grade Build is: Error:(20, 28) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.NoActionBar'). Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Firetrust/Library/Android/sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 1 – charlotteg Nov 10 '15 at 21:19
  • What SDK level are you using? Did you already install it? – frogatto Nov 10 '15 at 21:22
  • It was automatically 23 but the tut I'm doing needed the exact same otherwise certain icons aren't visible and i went to packages and installed 21 i think i should have worked. – charlotteg Nov 10 '15 at 21:34
  • So, make sure you've installed those SDKs on your machine. – frogatto Nov 10 '15 at 21:38
  • Yes i have, they are there. The http://schemas etc is working fine no errors on my content_main.xml just not in the AndroidManifest.xml – charlotteg Nov 10 '15 at 21:44
  • http://stackoverflow.com/questions/26446610/android-gradle-project-upgrading-build-tools-to-21-0-1-aapt-throws-exception this question also shows some of the errors that I'm getting. – charlotteg Nov 10 '15 at 21:49

5 Answers5

2

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.

shivench
  • 54
  • 6
1

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" >
adelphus
  • 10,116
  • 5
  • 36
  • 46
1

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

Đốc.tc
  • 530
  • 4
  • 12
1

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

musterdo
  • 11
  • 1
0

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)

jj kk
  • 1