如何为发布版本和调试版本使用不同的清单文件?
是否可以在 Android Studio 中为我的 APK 的调试版本和发布版本使用不同的清单文件?
Is it possible to have different manifest files for the debug and release versions of my APK in Android Studio?
通常我不需要这样的东西,但在调试模式下,我的应用程序在不同的用户 ID 和进程中运行,这在清单中定义.我附上了我的调试清单的差异:
Normally I don't have need for such a such a thing but in debug mode, my applications run in a different user id and process and this is defined in the manifest. I've attached a diff of what my debug manifest has:
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mridang.address"
+ android:sharedUserId="com.mridang.dashclock"
android:versionCode="10"
android:versionName="1.0" >
@@ -14,6 +15,7 @@
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
+ android:process="com.mridang.dashclock"
android:label="@string/application_name"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar" >
我对在构建之前隐藏调试清单文件并弹出它失去了理智,如果可以使用两个单独的清单,那就太好了.
I'm losing my mind with stashing the debug manifest file and popping it before building and if two separate manifests were possible, that would be great.
在 src/下创建一个debug"文件夹并将其放入:https://github.com/androidfu/Now-Playing/tree/master/app/src
Create a "debug" folder under src/ and put it in there: https://github.com/androidfu/Now-Playing/tree/master/app/src
我的发布"清单在 src/main/中,但我很确定如果您需要两个完全独立的清单文件,您可以使用 src/release/和 src/debug/.
My "release" manifest is in src/main/, but I'm pretty sure if you needed two wholly separate manifest files you could use src/release/ and src/debug/.