Christopher Hamilton, 17 Windsor Crescent, Maddiston, committed the cultivation and selling offences between October 1, 2017 and April 5, 2018.
He also admitted possessing cClass A drug cocaine on April 5.
Hamilton failed to turn up for criminal justice social work appointments on two occasions – stating he had temporarily moved from his address so he did not receive notice of the appointment dates.
Sheriff Derek Livingston said: “You had two opportunities to turn up and you failed to do so.”
He remanded Hamilton in custody until June 21 so a report could be obtained.