The growing number of smartphones, particularly Android powered ones, has increased public awareness of the security concerns posed by malware and viruses. While machine learning models have been studied for malware prediction in this field, methods for precise identification and classification still require improvement for the perfect detection of malwares and minimizing the cracks on machine learning based classification. Detection accuracy that ranges from 93% to 95% has been observed in prior research, indicates room for improvement. In order to maximize the hyperparameters, this paper suggests improving the Random Forest method by introducing the grid search algorithm which isn’t present in previous studies. A significant increase in classification accuracy is the main aim of the research. We exhibit an outstanding 99% accuracy rate in detecting malware contaminated programs, demonstrating the significance of our technique. The proposed method can be seen as a huge improvement over existing models, achieving near perfection in detection, in contrast to which typically obtained by previous models with the accuracy rate of 95% max on the same dataset. Our approach achieves such high accuracy and provides a novel remedy for the limits of the Android based platforms, particularly when program processing resources are limited. This study confirms the effectiveness of our improved Random Forest algorithm, points to a paradigm shift in malware detection, and heightened cybersecurity measures for the rapidly growing smartphone market.