Last Friday, two men armed with a handgun held up a credit union in Portmarnock and made off with cash.
They were confronted by a garda on patrol in the area. Shots were fired at the officer, who was uninjured, before a car was hijacked.
Two men were arrested following the incident and yesterday afternoon Derek Murphy appeared before Judge Patricia McNamara at Dublin District Court.
Murphy, who is from Macroom Avenue, Coolock, also has an address at Springdale Road, Raheny, north Dublin.
He is accused of having a handgun at St Samsons Court, Balgriffin, in north Co Dublin, on November 16.
Garda Brian Pentony told the court that when the gun charge was put to him at Coolock Garda Station on Sunday evening, Murphy replied: "On the advice of my solicitor I was advised to remain silent."
Judge McNamara was told that Murphy is in receipt of social welfare and that he was not applying for bail yesterday.
He was granted legal aid and remanded in custody to appear at Cloverhill District Court on Thursday.
Yesterday evening, 18-year-old Sean Donnelly, from Belcamp Crescent, Coolock, was brought before a late sitting of the District Court charged with robbery at Portmarnock Credit Union.
Garda Shane McGrath said that Donnelly was charged yesterday and he no reply when cautioned. Garda McGrath said a firearm was produced and discharged at member of the gardai but said he accepted that Donnelly was not the shooter.
He also told Judge Bryan Smyth that a car was hijacked and two people are alleged to have been involved.
He sought strict bail conditions, including an independent surety of €1,000 and for Donnelly to sign on four times a week at Coolock Garda station, not associate with his co-accused, not go to the Portmarnock and obey a 11pm to 7am curfew.
Judge Smyth remanded him in custody with consent to bail on those conditions. His next hearing will take place at Cloverhill District Court on Thursday.