2014-12-13 90 views
1

我遇到了驅動器中的問題。我無法導入它。我得到的錯誤是DriveScopes無法解析爲變量。無法導入驅動器

private ProgressBar progressBar; 
    private Context context; 
    private static Uri callLogFileUri; 
    private static Uri smsLogFileUri; 
    private static Drive service; 
    private boolean callLogs; 
    private boolean smsLogs; 
    private String address; 
    private ContentResolver cr; 
    private GoogleAccountCredential credential; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.backup_layout); 

     progressBar = (ProgressBar) findViewById(R.id.progressBar); 
     progressBar.setVisibility(View.VISIBLE); 

     context = this; 
     Intent intent; 
     cr = getContentResolver(); 
     credential = GoogleAccountCredential.usingOAuth2(this,DriveScopes.DRIVE); 

     try { 
      intent = getIntent(); 

      if (intent.hasExtra("fromReceiver")) { 
       address = intent.getStringExtra("fromReceiver"); 
       Log.i(TAG, "Backup intent from receiver"); 
       recoverData(); 
      } else { 
       Log.i(TAG, "Backup intent from elsewhere"); 
       DialogFragment dialog = new BackupAccountsDialogFragment(); 
       dialog.show(getFragmentManager(), 
         "BackupAccountsDialogFragment"); 
      } 

     } catch(Exception e) { 
      recoverData(); 
     } 
    } 

    @Override 
    protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { 
     switch (requestCode) { 
     case REQUEST_ACCOUNT_PICKER: 
     if (resultCode == RESULT_OK && data != null && data.getExtras() != null) { 
      final String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); 
      if (accountName != null) { 
      Log.i(TAG, "REQUEST ACCOUNT PICKER"); 
      credential.setSelectedAccountName(accountName); 
      service = getDriveService(credential); 
      storeGoogleAccounts(accountName); 
      Log.i(TAG, "Account saved: " + CHOSEN_GOOGLE_ACCOUNT + " " + accountName); 
      getFirstAuthInAsync(); 
      } 
+0

'Drive service' does compile? – greenapps 2014-12-13 09:52:23

回答

0

您是否在IDE中添加了Drive的jar(類似Eclipse)?

如果沒有,那麼你必須這樣做。所以javac可以找到導入路徑。

+0

我有IDE和eclipse上的工作。哪裏添加? – 2014-12-13 01:45:53

+0

現在你有.jar文件嗎?它叫什麼名字?現在它在哪裏? – greenapps 2014-12-13 09:50:41