Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have different manifest files for the release and debug versions?

Tags:

Is it possible to have different manifest files for the debug and release versions of my APK in Android Studio?

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.

like image 713
Mridang Agarwalla Avatar asked Mar 28 '15 13:03

Mridang Agarwalla


People also ask

How many manifest file can be in an application?

Your APK or Android App Bundle file can contain just one AndroidManifest. xml file, but your Android Studio project may contain several—provided by the main source set, build variants, and imported libraries.

How do I change the manifest in APK?

To edit the apk, open explorer and navigate to the folder apktool is unzipped to, and open the folder with the name of your apk. Inside you'll find a bunch of folders and a file called AndroidManifest. xml. If you want to edit the icon, open res -> drawable.

What is custom manifest file?

The Android manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play. Every Android app or unity app running on the Android platform must have a Manifest file.


2 Answers

Create a "debug" folder under src/ and put it in there: https://github.com/androidfu/Now-Playing/tree/master/app/src

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/.

like image 122
Bill Mote Avatar answered Oct 23 '22 07:10

Bill Mote


Yes, it is possible. Use this paths:

Debug Manifest: ../src/debug/AndroidManifest.xml

Release Manifest: ../src/release/AndroidManifest.xml


Show Release Manifest on Android Studio:

  1. Open Build Variants Window
  2. Change from debug to release
  3. Will be visible on Project -> Android -> manifests
like image 36
Paulo Pereira Avatar answered Oct 23 '22 06:10

Paulo Pereira