Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Multiple versions of app with different package names
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
BrianS  
View profile  
 More options Jan 8 2010, 6:01 pm
From: BrianS <bnsaw...@aol.com>
Date: Fri, 8 Jan 2010 15:01:19 -0800 (PST)
Local: Fri, Jan 8 2010 6:01 pm
Subject: Multiple versions of app with different package names
Hi--

I need to be able to easily create different "flavors" on an app, each
with a unique package name so that they can coexist on the same
device. Is there a simple way this can be done, which doesn't require
manually updating all the imports and other references to the package
name each time I change it?

Thanks much!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Multiple versions of app with different package names" by Mark Murphy
Mark Murphy  
View profile  
 More options Jan 8 2010, 6:05 pm
From: Mark Murphy <mmur...@commonsware.com>
Date: Fri, 08 Jan 2010 18:05:44 -0500
Local: Fri, Jan 8 2010 6:05 pm
Subject: Re: [android-developers] Multiple versions of app with different package names

BrianS wrote:
> Hi--

> I need to be able to easily create different "flavors" on an app, each
> with a unique package name so that they can coexist on the same
> device. Is there a simple way this can be done, which doesn't require
> manually updating all the imports and other references to the package
> name each time I change it?

This was just discussed today:

http://groups.google.com/group/android-developers/browse_thread/threa...

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.1 Available!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Multiple versions of app with different package names" by Lance Nanek
Lance Nanek  
View profile  
 More options Jan 8 2010, 7:41 pm
From: Lance Nanek <lna...@gmail.com>
Date: Fri, 8 Jan 2010 16:41:10 -0800 (PST)
Local: Fri, Jan 8 2010 7:41 pm
Subject: Re: Multiple versions of app with different package names
I managed to do it without updating the imports, but it is pretty
nasty besides that.

I have two projects, lets call them A and B. All the directories in
project B are actually just SVN externals that reference the
directories of project A:
http://svnbook.red-bean.com/en/1.0/ch07s03.html

Therefore the only thing different about project B, when it is fully
up to date with the repository, is the AndroidManifest.xml. That's a
duplicate except that I change the package name.

The code can tell the package being used via Context#getPackageName.
Project B has project A in its Java build path in Eclipse, so all the
R class imports written for project A work even in project B.
Occasionally there is a random build error and I have to remove
project A from the build path and put it back, or open and close the
project.

I saw someone mention that aapt can be used manually to generate the R
class in a different package than normal. So maybe a cleaner way to do
this, without giving up and doing the change all the imports thing
each build, is to use that to generate an R class for B that is in A's
package. That would remove the scary hack of having project B access
its own resources via project A's R class, which just happens to be
generated with the same values because all the files are the same.

On Jan 8, 6:01 pm, BrianS <bnsaw...@aol.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jarkman  
View profile  
 More options Feb 15 2010, 2:05 pm
From: jarkman <jark...@gmail.com>
Date: Mon, 15 Feb 2010 11:05:57 -0800 (PST)
Local: Mon, Feb 15 2010 2:05 pm
Subject: Re: Multiple versions of app with different package names
I'm just going through a similar exercise in order to build lite and
pro versions of the app from a single codebase.

I'm using an Ant script derived from this one:
http://ulrichscheller.blogspot.com/2009/10/android-deploying-multiple...
which converts the project from one target to the other.

The Ant script only does three things:

(1) Copies the resources which are different for the two targets into
the /res directory

(2) Changes import com.company.product.lite.R; into  import
com.company.product.pro.R; (or vice-versa) in all the Java files

(3) Changes the package name in the manifest from
com.company.product.lite into com.company.product.pro

I'm suprised to find that I can leave the package name
(com.company.product) unchanged in the java files, and my pro and lite
builds can coexist on a device. I had expected a clash of classnames
there.

I only have a couple of wrinkles remaining. I need to use a different
name (or maybe a different authority?) for my provider for the two
variants:
    <provider android:name="com.company.product.MyProvider"
            android:authorities="com.company.product.MyProvider"
    />
since having that identical in both apps stops the second one loading.

And, because I am using the same mime type and so on in my intents,
having both apps installed means that most activity transitions go
through a chooser asking the user which version of the app to use.
That may be acceptable, because I don't expect both apps to be
installed for long over the lite->pro upgrade.

Richard

On Jan 9, 12:41 am, Lance Nanek <lna...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »