Unexpected error: NullpointerException when replacing external dependency