I followed all steps listen under https://developers.google.com/drive/quickstart-android It works! But if im going to merge the given code/package to an other project, im ge
You should catch the UserRecoverableAuthException and in the catch block, you recover the Intent from the exception by calling UserRecoverableAuthException#getIntent(). Start that intent to take user to the OAuth2 permission page for your app.
Sample code -
try {
Drive service = Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential)
.build();
// Do whatever you want with the Drive service
} catch (UserRecoverableAuthIOException e) {
startActivityForResult(e.getIntent(), REQUEST_AUTHORIZATION);
}