質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

1回答

2300閲覧

android studioへのgoogle cloud vision apiのサンプルの取り込み方

退会済みユーザー

退会済みユーザー

総合スコア0

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

1クリップ

投稿2018/09/08 05:04

編集2022/01/12 10:55

前提・実現したいこと

初心者です。
android studioにGitHubからダウンロードしたgoogle cloud vision apiのサンプルを入れたのですが、次のようなエラーが出てしまいます。
すみませんがわかる方教えてくださいませんか。

発生している問題・エラーメッセージ

Error:(14, 40) エラー: シンボルを見つけられません
シンボル: 変数 ApiKey
場所: クラス BuildConfig

該当のソースコード

build.gradle(Module:app) apply plugin: 'com.android.application' android { compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { applicationId "com.google.sample.cloudvision" minSdkVersion 24 targetSdkVersion 27 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } buildTypes.each { it.buildConfigField 'String', 'API_KEY',Apikey } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:27.0.2' compile 'com.android.support:design:27.0.2' compile 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient' compile 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient' compile 'com.google.apis:google-api-services-vision:v1-rev369-1.23.0' }

java

1BuildConfig.java 2 3/** 4 * Automatically generated file. DO NOT MODIFY 5 */ 6package com.google.sample.cloudvision; 7 8public final class BuildConfig { 9 public static final boolean DEBUG = Boolean.parseBoolean("true"); 10 public static final String APPLICATION_ID = "com.google.sample.cloudvision"; 11 public static final String BUILD_TYPE = "debug"; 12 public static final String FLAVOR = ""; 13 public static final int VERSION_CODE = 1; 14 public static final String VERSION_NAME = "1.0"; 15 // Fields from build type: debug 16 public static final String API_KEY = Apikey; 17}

補足情報(FW/ツールのバージョンなど)

AndroidStudio3.0

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

APIキーを取得して埋め込みましょう。
https://cloud.google.com/docs/authentication/api-keys

投稿2018/09/10 08:10

kakajika

総合スコア3131

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2018/09/12 02:06

MainActivity.java public class MainActivity extends AppCompatActivity { private static final String CLOUD_VISION_API_KEY = "AIzaSyCO1MyOLgqfaYh_J4lQBKs34Nrr6OvXIRo"; にAPIキーを埋め込んでもエラーが出てきてしまいます。他にどこかAPIキーを埋め込む場所があるのでしょうか。
kakajika

2018/09/12 04:34

build.gradle内でApiKeyが定義されていないとエラーが出ているのですから、そこに埋め込んでください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問