I'm badly stuck after updating to Android 3.0.0 and gradle update to 4.1. My app is not building and the manifest contains a lot of errors. I tried cleaning the project under Build
, invalidate caches/restart under Files
, without success.
The errors I recieve are as following:
Error:(52) error: unknown element found.
Error:(52) unknown element found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
All errors are in debug\AndroidManifest
. When I delete or comment the marked activities, they're getting added back on gradle build,
I'm also getting an 'URI not registrered error too with android="http://schemas.android.com/apk/res/android"
'
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sample.app"
android:installLocation="auto"
android:versionCode="48"
android:versionName="4.8" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="25" />
//Hardware Constraints for Application
<uses-feature android:name="android.hardware.location.gps" />
<!-- <uses-feature android:name="android.hardware.location.network" /> -->
//Required App Permissions
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
<uses-permission-sdk-23 android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.1" />
<activity android:name="com.box.androidsdk.content.auth.OAuthActivity" />
<uses-feature
android:name="android.hardware.sensor.accelerometer"
android:required="true" /> <!-- Permissions required for GCM -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="sample.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="sample.app.permission.C2D_MESSAGE" />
<!--
<uses-feature
android:name="android.hardware.camera2.full"
android:required="true" />
-->
<!--
<uses-feature
android:name="android.hardware.sensor.accelerometer"
android:required="true" />
-->
<application
android:name="sample.app.dailymotion.volleyapp.AppController"
android:allowBackup="true"
android:debuggable="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<!--
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode"/>
-->
<activity android:name="sample.app.SplashScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="sample.app.ClrInfo"
android:exported="false"
android:theme="@style/MyDialogTheme" />
</application>
</manifest>
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.
No need to disable AAPT2. :) In line 56 of your AndroidManifest.xml you define an activity:
<activity android:name="com.box.androidsdk.content.auth.OAuthActivity" />
The 'activity' tag can only be nested under the 'application' element. For more info please look at the Android Manifest structure documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With