Hi Muditha,
Is there a reason why you are using an SDK that is no longer supported as opposed to the most recent? See ArcGIS Runtime SDK for Android (latest) | ArcGIS for Developers , the latest version is 100.7. Information regarding Gradle is in the guide topic Install the SDK—ArcGIS Runtime SDK for Android | ArcGIS for Developers . However, I have no idea what the matching class is for DynamicMapServiceLayer.
There's also version 10.2.9 which is also in mature support, referencing the class
ArcGISDynamicMapServiceLayer | ArcGIS Android 10.2.9 API but this may help you better.