###前提・実現したいこと
OneDrive APIの組込をして、ビルドでエラーが出ないようにしたいのです。
OneDrive APIの組込自体はFile>New>Import Moduleして組み込んであります。
また、[com.onedrive.sdk]を参照出来るようにはしてあります。(自作したプロジェクトにOneDriveSDK APIを紐付けてあります)
###発生している問題・エラーメッセージ
OneDrive APIの組込後、ビルドするとAndroidManifestのマージでエラーが出てビルドに失敗するので困っています。 【Gradle Consoleに表示されているエラー内容】 C:\AndroidStudioProjects\StaffCalendar\app\src\main\AndroidManifest.xml:27:9-31 Error: Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
###該当のソースコード
Android
1【元々のAndroidManifest.xml】(一部抜粋&まずい所は伏せてあります) 2 3行 418 <activity 519 android:name=".MainActivity" 620 android:screenOrientation="portrait" 721 > 822 <intent-filter> 923 <action android:name="android.intent.action.MAIN" /> 1024 <action android:name="xxx.xxxxxxxxxxxxxxxxx.staffcalendar" /> 1125 1226 <category android:name="android.intent.category.LAUNCHER" /> 1327 1428 <action android:name="android.intent.action.VIEW" /> 1529 <category android:name="android.intent.category.DEFAULT" /> 1630 <category android:name="android.intent.category.BROWSABLE" /> 1731 1832 <!--Add in your scheme/host from registered redirect URI--> 1933 <!--By default, the scheme should be similar to 'msal[appId]' --> 2034 <data android:scheme="xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 2135 android:host="auth" /> 2236 </intent-filter> 2337 </activity> 24
###試したこと
【自分なりの訳】
属性 meta-dataの「android.support.VERSION@value」が「25.3.1」でAndroidManifest.xmlの27行で定義されていて
[com.android.support:support-v4:26.0.0-alpha1]のAndroidManifest.xmlの27行では、
「android.support.VERSION@value」が「26.0.0-alppha1」になっている
提案:オーバーライドする為にAndroidManifest.xmlの25行の<meta-data>の要素に「tools:replace="android:value"」を追記しろ
上記の様に解釈したので、以下の様に修正し、リビルドしてみたのですが
【修正後のAndroidManifest.xml】(一部抜粋)
行
22 <intent-filter>
23 <action android:name="android.intent.action.MAIN" />
24 <action android:name="xxx.xxxxxxxxxxxxxxxxx.staffcalendar" />
25 <!--追記 ここから-->
26 <meta-data tools:replace="android:value" />
27 <!--ここまで-->
28
(~~~(省略)~~~)
39 </intent-filter>
下記のエラーが出ました。
【Gradle Consoleに表示されているエラー内容】
C:\AndroidStudioProjects\StaffCalendar\app\src\main\AndroidManifest.xml:26:17-60 Error:
Missing 'name' key attribute on element meta-data at AndroidManifest.xml:26:17-60
C:\AndroidStudioProjects\StaffCalendar\app\src\main\AndroidManifest.xml:26:17-60 Error:
tools:replace specified at line:26 for attribute android:value, but no new value specified
【自分なりの訳】
AndroidManifest.xmlの26行の要素 meta-dataのキー 'name' が無い
AndroidManifest.xmlの26行に属性「android:value」の為の「tools:replace 」が定義されているが、
新しい値が定義されていない
ええと、つまりこう直せばいいのか?と、以下の様に修正してリビルドしました。
【修正後のAndroidManifest.xml】(一部抜粋)
行
25 <!--追記後の修正 ここから-->
26 <meta-data tools:replace="android:value"
27 android:name="android.support.VERSION"
28 android:value="25.3.1" />
29 <!--ここまで-->
すると下記のエラーが出ました。
【Gradle Consoleに表示されているエラー内容】
C:\AndroidStudioProjects\StaffCalendar\app\src\main\AndroidManifest.xml:28:21-43 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from AndroidManifest.xml:28:21-43
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
【自分なりの訳】
AndroidManifest.xmlの28行で属性 meta-dataのandroid.support.VERSIONの値が(25.3.1)だが、
[com.android.support:support-v4:26.0.0-alpha1]のAndroidManifest.xmlの27行では(26.0.0-alpha1)となっている
提案:オーバーライドする為にAndroidManifest.xmlの25行の<meta-data>の要素に「tools:replace="android:value"」を追記しろ
えーと・・・? じゃぁこれでどう?と、以下の様に変更してリビルド
<!--追記後の修正 ここから--> <meta-data tools:replace="android:value" android:name="android.support.VERSION" android:value="26.0.0-alpha1" /> <!--ここまで-->
【Gradle Consoleに表示されているエラー内容】
C:\AndroidStudioProjects\StaffCalendar\app\src\main\AndroidManifest.xml:28:21-50 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from AndroidManifest.xml:28:21-50
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
あれ? valueの値変えてみたのにエラーの内容に変化がない。 だめだ、よく分からない、お手上げだ。
と言った次第です。
###補足情報(言語/FW/ツール等のバージョンなど)
Android Studio 2.3.3 (Java)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。