Android QuickStartを参考にGoogleカレンダーへのアクセスを試みています。
https://developers.google.com/calendar/quickstart/android#step_5_setup_the_sample
MainActivityのコードはpackage名以外、Android QuickStartから丸々コピペしています。
文字数の関係で記載できないので、入力したコードは上記サイトを参考ください。
appのGradleは以下の通りに変更しています。applicationIdは、APIコンソール上で入力したものと同じものを記載しています。
apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "example.calendar" minSdkVersion 17 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.google.android.gms:play-services-auth:15.0.1' implementation 'pub.devrel:easypermissions:0.3.0' implementation('com.google.api-client:google-api-client-android:1.23.0') { exclude group: 'org.apache.httpcomponents' } implementation('com.google.apis:google-api-services-calendar:v3-rev324-1.23.0') { exclude group: 'org.apache.httpcomponents' } }
アカウント入力と、サインイン画面まで進むのですが、カレンダーにデータが反映されません。
アカウント名を入力してサインインすると、ボタン下に
The following error occurred: null
と表示されます。
次の行でIOExceptionが発生し、onCanncelled()に飛んでいます。
Events events = mService.events().list("primary") .setMaxResults(10) .setTimeMin(now) .setOrderBy("startTime") .setSingleEvents(true) .execute();
デバッガーから、onCancelled() 内の「mLastError」を確認すると、
mLastError = com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException cause = com.google.android.gms.auth.GoogleAuthException: UNREGISTERED_ON_API_CONSOLE
このように表示されていました。
フィンガープリントなどの設定も行っているので、エラーが発生する原因が特定できなくて困っています。
このエラーが発生する原因は何が考えられるでしょうか?
回答1件
あなたの回答
tips
プレビュー