They Both Apply (ALMOST 1x damage)
On page 197 of the Player's Handbook, it states (bolds added):
Resistance and then vulnerability are applied after
all other modifiers to damage.
This means that you would apply resistance, and then vulnerability to damage, in that order. This often would mean that you would only take the normal (x1) amount of damage: but not always. Note that on page 7 of the PHB, it states:
There’s one more general rule you need to know at the outset. Whenever you divide a number in the game, round down if you end up with a fraction, even if the fraction is one-half or greater.
As such if the damage dealt was odd (eg, 15) first it would be halved, by resistance, rounding down (eg, to 7 from 7.5). This halved damage would then be doubled by vulnerability (eg, increasing it to 14).
DMs might ignore this fringe case, as it can only result in a 1 point damage difference. But it is an accurate feature of the rules as written.
As far as Immunity goes, Vulnerability/Resistance both apply to enemies who also have Immunity, but to no particular effect. After all, halving or doubling 0 will still result in 0.
Immunity/resistance would be applied before the damage transfer
Note the timing of the damage mentioned in the Shield Guardian's text (MM, p. 271, bold added)
If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.
A character hasn't "taken" damage until all the modifiers to damage have been factored in. For evidence of this, note the text on resistance and immunity in the PHB (p. 197, bold added).
Resistance and then vulnerability are applied after all other modifiers to damage. For example, a creature has resistance to bludgeoning damage and is hit by an attack that deals 25 bludgeoning damage. The creature is also within a magical aura that reduces all damage by 5. The 25 damage is first reduced by 5 and then halved, so the creature takes 10 damage.
This description implies that the following three things happen in this order:
- an attack or effect "deals" damage
- Immunity or resistance reduces the damage
- target "takes" damage.
Since the shield guardian transfers damage that its amulet's wearer "takes," it will transfer damage after the resistance/immunity had been applied.
As an example, in the case where the target (wearer of the amulet) has immunity to fire damage, an effect would deal fire damage, and then immunity would reduce that damage to 0. At that point, either your DM would say "your character doesn't take damage, so the Shield Guardian's effect doesn't activate" or would say "your character takes 0 damage, and half of 0 (rounded up) is 0." Either way, the Shield Guardian would take no damage if the wearer of the amulet was immune to that damage type.
Resistance would work similarly. If you are resistant to a damage type and are dealt damage of that type, your resistance would reduce the damage, then you would "take" the damage, but half of the damage "taken" would transfer to the Shield Guardian.
As a final corroboration, Jeremy Crawford has confirmed this reading.
If you have a shield guardian, half of any damage you take is transferred to the guardian—that's half of the damage you actually take, after resistances and the like.
Best Answer
First increase the damage, then apply reductions
The developers have explained how those abilities should work, based creatures that appear on certain adventure paths and monsters that do have that combination of abilities on the bestiaries.
In Mummy Mask #1 (The Half-dead City), there is a clay creature that has a vulnerability to fire, and being a construct, they have hardness , but first you increase the damage by 50%, then you apply hardness, then anything that goes through is normal damage, as explained by the author of the adventure and later confirmed by Robert G. McCreary (a developer).
Another example are the robot creatures from the Iron Gods adventure path, where they have linked to McCreary's answer several times when questioning the order of abilities and again confirmed by James Jacobs on his unofficial thread, because all robots are vulnerable to electricity, but some of them are also resistant to electricity, like the iconic Annihilator from the Inner Sea Bestiary cover, and even though they have hardness, they should not be treated as objects, just like other constructs.