Closed emanalzoaubi closed 2 years ago
@emanalzoaubi At an initial glance from your error it looks like you didn't set the beta-version.png image to be ignored by the Build Tools. It should be documented here: https://mobilebuildtools.com/images/configuring-images/#watermarking-images There is a section that details how to ignore the files and why in there.
Basically Android refuses to accept - characters in image names which is why you see the error being reported. On top of that you don't actually want this watermark image to be included in your app as a separate resource which is why you need to mark it as ignored in its JSON file
@bijington, Ok great! I've followed the documentation but I've got the below error "Unhandled error while executing ImageResizerTask". You can find "icon.json, beta-version.json & buildtools.json" in the attached. WatermarkTest.zip
@emanalzoaubi I think there may be a mistake in the documentation. I believe you need to include the file extension when specifying a sourceFile
. Could you try changing the following parts from your json files:
change:
{
"$schema": "http://mobilebuildtools.com/schemas/v2/resourceDefinition.schema.json",
"watermark": {
"sourceFile": "beta-version"
}
}
to:
{
"$schema": "http://mobilebuildtools.com/schemas/v2/resourceDefinition.schema.json",
"watermark": {
"sourceFile": "beta-version.png"
}
}
You will also need to do the same for the Images/Debug/icon.json
file.
@bijington unfortunately, the same error occurs😫 Are there any constraints about the images size or their padding? I tried to add the used images in the sample but no chance 😓 The output image that appears in the output window is: { "InputFile":"C:\Users\User\source\repos\WatermarkTest\Images\icon.png", "OutputFile":"obj\Debug\110\Resources\drawable-ldpi\icon.png", "OutputLink":"Resources\drawable-ldpi\icon.png","BuildAction":null,"Height":0, "Width":0,"Scale":0.1875,"RequiresBackgroundColor":false,"ShouldBeVisible":true, "BackgroundColor":"","PaddingFactor":0.0,"PaddingColor":"", "Watermark":{"sourceFile":"beta-version.png","opacity":0.95} } Does the build action is the reason for this error?
I can confirm that I can see the same issue using your files. I have attached a full solution that shows the problem.
I will aim to take a look at why this is failing at some point
I have finally managed to get around to investigating this (sorry for the delay). It looks like the watermark sourceFile
path needs to be fully qualified at the moment. This is still a bug but if you were to fully qualify it for now then you could likely work around the issue. Or better yet if you are only wanting to render a banner then you could make use of the Drawn Watermarks feature.
TL-DR; definitely a bug and I am currently working on a fix
This was fixed by PR #292. Do we leave this open until release or can we close it?
Description
I'm trying to add a watermark on the application icon. I added a beta-version.png image as described in the documentation. However, I got the error "Invalid file name: It must contain only [^a-zA-Z0-9_.]+. C:\Users\User\source\repos\App1\App1\App1.Android\obj\Debug\110\Resources\drawable-hdpi\beta-version.png". After that, I tried to downgrade Mobile.BuildTools library to version 1.4.0.638 and the error is gone. Also, I changed the watermark image to be betaversion, the error of Invalid name is gone but I got a new error "Unhandled error while executing ImageResizerTask"
Environment
Reproduction App