Search code examples
androidreact-nativebuildexpoeas

eas build error: assets_images_bgbanner.png: AAPT: error: file failed to compile


I'm trying to build an expo app using command "eas build -p android" and got the error like this:

[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseResources'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
[stderr]    > Android resource compilation failed
[stderr]      ERROR:/home/expo/workingdir/build/android/app/build/generated/res/react/release/drawable-mdpi/assets_images_bgbanner.png: AAPT: error: file failed to compile.
[stderr]          
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] java.lang.StackOverflowError (no error message)
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 6m 56s

here is my app.json file:

{
  "expo": {
    "name": "eworkbook-mobile",
    "slug": "eworkbook-mobile",
    "version": "1.0.0",
    "orientation": "portrait",
    "userInterfaceStyle": "light",
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.hatieudao.eworkbook"
    },
    "android": {
      "package": "com.hatieudao.eworkbook",
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      }
    },
    "extra": {
      "eas": {
        "projectId": "38e1dc19-4d84-4060-xxxx-xxxxxxxxxxx"
      }
    },
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "buildToolsVersion": "31.0.0"
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ]
    ]
  }
}

I dont know what to do with the error since I can't find the file "assets_images_bgbanner.png" or "bgbanner.png" anywhere in my project folder. In the asset folder there is just 4 images: adaptive-icon.png,favicon.png,icon.png,splash.png (just default expo images). Maybe the "assets_images_bgbanner.png" is the default image when build on cloud? If so how can I get rid off it or is there any way to fix this error?

I've tried to create my own "bgbanner.png" and put it in the asset folder, but the error is still the same


Solution

  • Ok, I found it. It's "bg-banner.png" not "bgbanner.png". Moreover, the file seem corrupted or something. I tried to open it with paint and save it. It's work.