FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:processDebugResources’.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
C:UserschaukAndroidStudioProjectsTestft_androidbuildappintermediatespackaged_manifestsdebugAndroidManifest.xml:52: error: attribute ‘android:name’ in tag must be a valid Java class name.
Here is my AndroidManifest.xml to check the required configuration.
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="testft_android">
<activity
android:name="com.example.testft_android.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
3
Answers
The error you’re seeing indicates an issue with the
android:name
attribute in the<application>
tag within yourAndroidManifest.xml
. Specifically,android:name="${applicationName}"
is not resolving to a valid Java class name, which is required by Android.Solution
The
android:name
attribute should either:"com.example.testft_android.MyApplication"
) if you’ve created a customApplication
class.Application
class.Steps to Fix
Remove or Correct the
android:name
Attribute:android:name
line entirely if you do not need a customApplication
class:Application
class (e.g.,MyApplication
incom.example.testft_android
), specify the full class name:Sync and Rebuild the Project:
After updating
AndroidManifest.xml
, sync your project with Gradle and try rebuilding it.This will resolve the issue.
Its possible you have a typo, but you can simplify this to
Or whatever the name of you application class is. If you don’t have an overridden application class, you do not need this attribute.