fix gradle config
integrate more libs and refactor codes