如何为发布版本和调试版本使用不同的清单文件? [英] How can I have different manifest files for the release and debug versions?

查看:27
本文介绍了如何为发布版本和调试版本使用不同的清单文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 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/.

这篇关于如何为发布版本和调试版本使用不同的清单文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆