gpt4 book ai didi

android - Google Drive Android API 教程问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:00:59 27 4
gpt4 key购买 nike

正在关注 this tutorial ,我将此代码粘贴到我的主要 Activity 中:

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
if (connectionResult.hasResolution()) {
try {
connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
} catch (IntentSender.SendIntentException e) {
// Unable to resolve, message user appropriately
}
} else {
GooglePlayServicesUtil.getErrorDialog(connectionResult.getErrorCode(), this, 0).show();
}
}

我最终不得不导入一个 buncha 库,但我仍然无法修复此错误:

RESOLVE_CONNECTION_REQUEST_CODE cannot be resolved to a variable

有什么想法吗???我不知道哪个库包含这个常量...

最佳答案

原来当教程指定从 android 项目开始时,它们意味着 Google Drive android 项目,它具有不同的导入和类定义,教程中没有明确说明。他们实际上为 Google Drive android 项目提供了一些起始代码,但他们错误地将其标记为“Android Quickstart”,因此我认为它与任何其他 android 项目没有什么不同。

enter image description here

这是链接所在的位置:Google Drive Android Quickstart ,如果您使用此代码作为引用,本教程会更有意义。

如果有人好奇原始问题的解决方法是什么,常量实际上应该是REQUEST_CODE_RESOLUTION,但还是有很多变化,所以只需使用 Google Drive Android Quickstart

关于android - Google Drive Android API 教程问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24420827/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com