【发布时间】:2017-12-20 01:38:50
【问题描述】:
我的 Android 应用将文件转储到 Gdrive 中。它使用 Oauth2.0 身份验证,我已经在 console.developers.google.com 上完成了必要的工作。我面临的问题是该应用程序在我的 Marshmallow 手机上运行良好,但无法通过我的 JellyBean 或更低版本的 Google 登录。在这些情况下,应用会卡在“选择帐户”窗口。
Studio 的 Android 监视器返回以下内容:
GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{419cbb80 ...
请记住,该应用确实可以在 Marshmallow 手机上运行,我怀疑该问题与该应用的 build.grade 文件中的“版本”之一有关,下面是其中的摘录。
compileSdkVersion 23
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "rudy.android.stgpro"
minSdkVersion 9
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.rudykeystore
}
debug {
signingConfig signingConfigs.rudykeystore
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-drive:8.4.0'
}
或者,也许 Oauth2.0 不适用于早期的 Android 版本。
我还注意到,加载到 Marshmallow 中的应用大小大约是加载到其他两部手机中的大小的 40%。
Google 的云端硬盘应用可在所有手机上正常运行。
我已经在谷歌上搜索了几个小时,而且几乎被卡住了。有什么建议吗?
【问题讨论】:
-
Jelly Bean 是 Android 16 版本,但你的 targetSdkVersion 设置为 18。尝试将其设置为 16,根据Android 4.1 APIs docs。确保 Android Studio 也有 Android 16 的必要更新。
-
试过了......没有运气。其实我已经试过好几种compileSdkVersion、minSdkVersion、targetSdkVersion、play-services-drive的组合了。
标签: android oauth-2.0 google-drive-api