「Android/開発環境/AndroidStudio/ライブラリのAndroidManifest指定」の版間の差分
提供: 初心者エンジニアの簡易メモ
| 行19: | 行19: | ||
app/build/intermediates/merged_manifests/debug/AndroidManifest.xml | app/build/intermediates/merged_manifests/debug/AndroidManifest.xml | ||
/app/build/intermediates/instant_app_manifest/debug/AndroidManifest.xml | /app/build/intermediates/instant_app_manifest/debug/AndroidManifest.xml | ||
| + | </pre> | ||
| + | |||
| + | mylibrary | ||
| + | のsrc/main/AndroidManifest.xmlに以下を追加 | ||
| + | <pre> | ||
| + | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| + | package="com.example.mylibrary"> | ||
| + | |||
| + | <meta-data | ||
| + | android:name="hoge" | ||
| + | android:value="mylibrary" /> | ||
| + | |||
| + | </manifest> | ||
</pre> | </pre> | ||
2020年10月23日 (金) 13:20時点における版
ライブラリのbuild.gradleに以下を記述
android {
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
}
そのファイルがあるdirのsrc/main/AndroidManifest.xmlにAndroidManifestを記述すると、
元々のAndroidManifestは無効になって、置き換わってるっぽい。
マージされたAndroidManifest.xml
以下にマージされたAndroidManifest.xmlが出力される
app/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml app/build/intermediates/merged_manifests/debug/AndroidManifest.xml /app/build/intermediates/instant_app_manifest/debug/AndroidManifest.xml
mylibrary のsrc/main/AndroidManifest.xmlに以下を追加
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mylibrary">
<meta-data
android:name="hoge"
android:value="mylibrary" />
</manifest>
