Android Studio 3.0 Manifest Error: Unknown Element <Action> Found

Android Studio 3.0 Manifest Error: unknown element action found

You have a misplaced tag. The new AAPT (AAPT2) now throws an error on this.

From the docs in here: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

Behavior changes when using AAPT2


To improve incremental resource processing, Android plugin 3.0.0 enables AAPT2 by default. Although AAPT2 should immediately work with older projects, this section describes some behavior changes that you should be aware of.

Element hierarchies in the Android manifest

In previous versions of AAPT, elements nested in incorrect nodes in the Android manifest are either ignored or result in a warning. For example, consider the following sample:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myname.myapplication">
<application
...
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<action android:name="android.intent.action.CUSTOM" />
</activity>
</application>
</manifest>

Previous versions of AAPT would simply ignore the misplaced tag. However, with AAPT2, you get the following error:

AndroidManifest.xml:15: error: unknown element <action> found.

To resolve the issue, make sure your manifest elements are nested correctly. For more information, read Manifest file structure.

Android Studio 3.0 Beta 2 - unknown element action found in AndroidManifest.xml

Updating the gradle version or downgrading it didn't resolved the issue

I have got the similar issue recently, The way I solved is by invalidating the cache. You can do that in android studio-> File-> Invalidate cache/ Restart.

After that it stop showing me those ActivityFeed error.

My Android manifest is full of errors after updating to Android 3.0.0

The Android docs mentioned about the migration guide here : https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

Element hierarchies in the Android manifest

In previous versions of AAPT, elements nested in incorrect nodes in
the Android manifest are either ignored or result in a warning. For
example, consider the following sample:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myname.myapplication">
<application
...
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<action android:name="android.intent.action.CUSTOM" />
</activity>
</application>
</manifest>

Note that you must check your Manifest if you really comply to the specific nesting rule they provided otherwise your app wont compile.

Manifest file structure

The code snippet below shows the general structure of the manifest
file and every element that it can contain. Each element, along with
all of its attributes, is fully documented in a separate file.

<manifest>

<uses-permission />
<permission />
<permission-tree />
<permission-group />
<instrumentation />
<uses-sdk />
<uses-configuration />
<uses-feature />
<supports-screens />
<compatible-screens />
<supports-gl-texture />

<application>

<activity>
<intent-filter>
<action />
<category />
<data />
</intent-filter>
<meta-data />
</activity>

<activity-alias>
<intent-filter> . . . </intent-filter>
<meta-data />
</activity-alias>

<service>
<intent-filter> . . . </intent-filter>
<meta-data/>
</service>

<receiver>
<intent-filter> . . . </intent-filter>
<meta-data />
</receiver>

<provider>
<grant-uri-permission />
<meta-data />
<path-permission />
</provider>

<uses-library />

</application>

</manifest>

In your case you must transfer your

<activity android:name="com.box.androidsdk.content.auth.OAuthActivity" />

inside in <application> so that it will compile.

Disabling AAPT2 is just a workaround but not a real answer.

Android Studio 3.0.1 unknown element user-permission found

<user-permission android:name="android.permission.INTERNET" />

There is no such element. Most likely, you want <uses-permission>:

<uses-permission android:name="android.permission.INTERNET" />

So, will I be able to access a file like this?: localhost:8080/login.php

No, assuming that localhost is your development machine. Your development machine is not your Android device, nor is it your Android emulator. For a device, or for an emulator running on some other computer, you will need the actual IP address of your development machine. If you are using the Android emulator on the same machine as this Web server, replace localhost with 10.0.2.2, as is covered in the documentation.

AAPT2 error: check logs for details: unknown element action found

AndroidManifest.xml:15: error: unknown element found.

You have a misplaced tag.

To improve incremental resource processing, Android plugin 3.0.0 enables AAPT2 by default.
In previous versions of AAPT, elements nested in incorrect nodes in the Android manifest are either ignored or result in a warning.

To resolve the issue, make sure your manifest elements are nested correctly. For more information, read Manifest file structure.

You have to modify your Manifest:

 <action android:name="com.company.sqh.adio.ProfileActivity" />         
<category android:name="android.intent.category.DEFAULT" />

They should be included inside an <activity> tag.

You can read more here.

AAPT: error: unknown element uses-feature found in debug Manifest

Move <uses-feature android:name="android.hardware.camera" android:required="true" /> outside of <application> tag as follows:

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

...

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />

<application
android:name="com.myapp.MainApplication"
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="myapp"
android:theme="@style/AppTheme" >
...
</application>

</manifest>

How can I fix unexpected element queries found in manifest error?

The Android Gradle Plugin needs to know about new manifest elements, particularly
for the manifest merger process. The plugin has a tendency to get confused if it
sees elements in the manifest merger that it does not recognize, tossing out
build errors like the one in the question.

In this case, Android 11 introduced <queries> as a manifest element, and older versions of the Android Gradle Plugin do not know about that element.

The fact that this occurs from manifest merger means that simply upgrading a dependency
might bring about this error. For example, if you upgrade to the latest
version of com.awesome:awesome-library, and it contained a <queries> element
in its manifest, you might crash with the aforementioned error in your builds,
even without any other changes in your code.

Google released a series of patch versions of the Android Gradle Plugin to address this:

  • 3.3.3
  • 3.4.3
  • 3.5.4
  • 3.6.4
  • 4.0.1

If you are using an existing plugin in the 3.3.* through 4.0.* series, upgrade
to the associated patch version (or higher) from that list, and you should no longer
run into that error (e.g., classpath 'com.android.tools.build:gradle:4.0.1').

If you are using Android Studio 4.1 or higher, with a matching
Android Gradle Plugin (e.g., in the 4.1.* series), you should be fine without
any changes. Those plugin versions were already aware of <queries>.

See this Android Developers Blog post for more.



Related Topics



Leave a reply



Submit