The pain in your knees and the cracking of kneecap is an alarming situation, which cannot be ignored. It could indicate damage to knee. The cartilage s in the knee act as protective mechanism and prevent wear and tear.
There could be a lot of reasons for the pain which include:
A) Meniscus tear / cartilage tear.
B) Anterior cruciate ligament injury
C) Chrondromalacia patella.
I would suggest you to get an x ray of bilateral knees along with an MRI knee and consult the Orthopedician with results of the reports.