Fix build errors and gradle setup