skip to Main Content

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


  1. The error you’re seeing indicates an issue with the android:name attribute in the <application> tag within your AndroidManifest.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:

    1. Reference a fully qualified Java class name (e.g., "com.example.testft_android.MyApplication") if you’ve created a custom Application class.
    2. Be omitted if you don’t need a custom Application class.

    Steps to Fix

    1. Remove or Correct the android:name Attribute:

      • Option 1: Remove the android:name line entirely if you do not need a custom Application class:
        <application
            android:icon="@mipmap/ic_launcher"
            android:label="testft_android">
        
      • Option 2: If you have a custom Application class (e.g., MyApplication in com.example.testft_android), specify the full class name:
        <application
            android:name="com.example.testft_android.MyApplication"
            android:icon="@mipmap/ic_launcher"
            android:label="testft_android">
        
    2. Sync and Rebuild the Project:
      After updating AndroidManifest.xml, sync your project with Gradle and try rebuilding it.

    This will resolve the issue.

    Login or Signup to reply.
  2. error: attribute ‘android:name’ in tag must be a valid Java class

    <application
        android:name="${applicationName}"
    
    1. clean and rebuild the project, check if it works leave the 2nd step.
    2. remove android:name property and rebuild the project.
    Login or Signup to reply.
  3. Its possible you have a typo, but you can simplify this to

    <application
        android:name=".MyApplication"
    

    Or whatever the name of you application class is. If you don’t have an overridden application class, you do not need this attribute.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search