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

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

新規登録して質問してみよう
ただいま回答率
85.48%
XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Gradle

Gradleは、ビルド自動化ツールです。 ソフトウェアパッケージやドキュメント、 または実際に何か他の種類のプロジェクトの構築、テスト、公開、展開などを自動化が出来ます

Android Studio

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

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

Q&A

0回答

905閲覧

androidスタジオにて,GoogleCloudVisonAPIのエラー解消したい.

stayhome

総合スコア1

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Gradle

Gradleは、ビルド自動化ツールです。 ソフトウェアパッケージやドキュメント、 または実際に何か他の種類のプロジェクトの構築、テスト、公開、展開などを自動化が出来ます

Android Studio

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

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

0グッド

0クリップ

投稿2022/10/18 11:43

編集2022/10/18 15:20

前提

androidスタジオにて,GoogleCloudVisonAPIを使用したいのです.
Githabより,サンプルプログラムをインストールして実行したのですが,XMLで記載されている部分に大量にエラーが出てしまている状態です.
どこが問題なのか,理解できていないので現状出ているエラーや関係ありそうなコード,載せておきます.
ソースコードは以下のURLに記載されていたものです.
Github:https://github.com/GoogleCloudPlatform/cloud-vision
どなたかわかる方,ご教授いただけると幸いです.

実現したいこと

GoogleCloudVisonAPIをアンドロイドスタジオ上で実行したい.

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

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
Build file 'C:\Users\user\AndroidStudioProjects\CloudVision\app\build.gradle' line: 20 A problem occurred evaluating project ':app'. > Could not find method buildConfigField() for arguments [String, API_KEY, BuildType_Decorated{name=ApiKey, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}] on BuildType_Decorated{name=debug, debuggable=true, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=SigningConfig_Decorated{name=debug, storeFile=C:\Users\user\.android\debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=C:\Users\user\.android\debug.keystore, v1SigningEnabled=true, v2SigningEnabled=true}, embedMicroApp=false, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.

該当のソースコード

XML

1<?xml version="1.0" encoding="utf-8"?> 2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 android:paddingBottom="@dimen/activity_vertical_margin" 8 android:paddingLeft="@dimen/activity_horizontal_margin" 9 android:paddingRight="@dimen/activity_horizontal_margin" 10 android:paddingTop="@dimen/activity_vertical_margin" 11 app:layout_behavior="@string/appbar_scrolling_view_behavior" 12 tools:context="com.google.sample.cloudvision.MainActivity" 13 tools:showIn="@layout/activity_main"> 14 15 <ScrollView 16 android:layout_width="match_parent" 17 android:layout_height="match_parent"> 18 19 <LinearLayout 20 android:layout_width="match_parent" 21 android:layout_height="wrap_content" 22 android:orientation="vertical"> 23 24 <TextView 25 android:id="@+id/image_details" 26 android:layout_width="match_parent" 27 android:layout_height="wrap_content" 28 android:layout_marginBottom="8dp" 29 android:text="Use the floating action button to select an image."/> 30 31 <ImageView 32 android:id="@+id/main_image" 33 android:layout_width="match_parent" 34 android:layout_height="200dp" 35 android:scaleType="fitCenter"/> 36 </LinearLayout> 37 </ScrollView> 38</RelativeLayout>

XML

1<?xml version="1.0" encoding="utf-8"?> 2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 android:paddingBottom="@dimen/activity_vertical_margin" 8 android:paddingLeft="@dimen/activity_horizontal_margin" 9 android:paddingRight="@dimen/activity_horizontal_margin" 10 android:paddingTop="@dimen/activity_vertical_margin" 11 app:layout_behavior="@string/appbar_scrolling_view_behavior" 12 tools:context="com.google.sample.cloudvision.MainActivity" 13 tools:showIn="@layout/activity_main"> 14 15 <ScrollView 16 android:layout_width="match_parent" 17 android:layout_height="match_parent"> 18 19 <LinearLayout 20 android:layout_width="match_parent" 21 android:layout_height="wrap_content" 22 android:orientation="vertical"> 23 24 <TextView 25 android:id="@+id/image_details" 26 android:layout_width="match_parent" 27 android:layout_height="wrap_content" 28 android:layout_marginBottom="8dp" 29 android:text="Use the floating action button to select an image."/> 30 31 <ImageView 32 android:id="@+id/main_image" 33 android:layout_width="match_parent" 34 android:layout_height="200dp" 35 android:scaleType="fitCenter"/> 36 </LinearLayout> 37 </ScrollView> 38</RelativeLayout>

Groovy

1apply plugin: 'com.android.application' 2 3android { 4 compileSdkVersion 27 5 buildToolsVersion "27.0.3" 6 7 defaultConfig { 8 applicationId "com.google.sample.cloudvision" 9 minSdkVersion 24 10 targetSdkVersion 27 11 versionCode 1 12 versionName "1.0" 13 } 14 buildTypes { 15 release { 16 minifyEnabled false 17 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 } 19 buildTypes.each { 20 it.buildConfigField 'String', 'API_KEY', ApiKey 21 } 22 } 23 compileOptions { 24 sourceCompatibility JavaVersion.VERSION_1_8 25 targetCompatibility JavaVersion.VERSION_1_8 26 } 27} 28 29dependencies { 30 compile fileTree(include: ['*.jar'], dir: 'libs') 31 testCompile 'junit:junit:4.12' 32 compile 'com.android.support:appcompat-v7:27.0.2' 33 compile 'com.android.support:design:27.0.2' 34 compile 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient' 35 compile 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient' 36 compile 'com.google.apis:google-api-services-vision:v1-rev369-1.23.0' 37} 38

試したこと

androidXへの移行など,調べながら試してみたのですが改善しませんでした.

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問