How to fix - Android build failed: Gradle build failed with unknown error.

I build my app with expo after running eas build I keep getting this same error Android build failed: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information."

this is the log: error.txt - Google Drive

eas.json

{
  "cli": {
    "version": ">= 2.6.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

I will appreciate your help, this is already frustrating me for the past 3 day now, I cant process to the next stage.

Thanks.

Hi @onseyi

It looks like there’s something wrong with some of your images. Maybe they are not actually PNGs?

Thanks @wodin for the response

Yes, I have used the image as a dummy data in my data.js file which I have commented cause I am not use it anymore

data.js

export const viewers = [
    {
        id: 1,
        profilePic: images.UserProfile3
    },
    {
        id: 2,
        profilePic: images.UserProfile4
    },
    {
        id: 3,
        profilePic: images.UserProfile1
    }
]

images.js

const UserProfile2 = require("../assets/pix/profile-pic-2.png")
const UserProfile3 = require("../assets/pix/profile-pic-3.png")
const UserProfile4 = require("../assets/pix/profile-pic-4.png")
const UserProfile5 = require("../assets/pix/urs.jpg")
export default {
    UserProfile1,    
    UserProfile2,    
    UserProfile3,    
    UserProfile4,    
    UserProfile5,    
}

Am I to remove it, so the error will not appear

Thanks @wodin for your response and yes I used the image as a dummy data to test before replacing it with api in my data.js which I no long need, I just commented the code.

Am I to remove it total for the error to fix.

data.js

import images from './images'
export const viewers = [
    {
        id: 1,
        profilePic: images.UserProfile3
    },
    {
        id: 2,
        profilePic: images.UserProfile4
    },
    {
        id: 3,
        profilePic: images.UserProfile1
    }
]

images.js

const UserProfile1 = require("../assets/pix/profile-pic-1.png")
const UserProfile2 = require("../assets/pix/profile-pic-2.png")
const UserProfile3 = require("../assets/pix/profile-pic-3.png")
const UserProfile4 = require("../assets/pix/profile-pic-4.png")
const UserProfile5 = require("../assets/pix/urs.jpg")

It looks like it’s only complaining about profile-pic-2.png, profile-pic-3.png and profile-pic-4.png.

If you’re on a Mac or Linux machine, try running:

file assets/pix/profile-pic-?.png

They should all say “PNG image data …”

e.g. if I do that in an app of mine, I get this:

% file assets/*.png
assets/adaptive-icon.png:                     PNG image data, 1024 x 1024, 8-bit colormap, non-interlaced
assets/favicon.png:                           PNG image data, 48 x 48, 8-bit colormap, non-interlaced
assets/icon.png:                              PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced
assets/simon-buchou-5Qd3Gj49gzk-unsplash.png: PNG image data, 1242 x 2048, 8-bit colormap, non-interlaced

You could also try copying e.g. your app’s icon or profile-pic-1.png over profile-pic-2.png, etc?

Thanks @wodin I have fix it I just, remove all the images profile-pic-2.png, profile-pic-3.png and profile-pic-4.png I am not making use of them.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.