Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would start by refactoring your existing codebase into an Android Library Project. This is pretty easy to do. <a href="http://developer.android.com/guide/developing/projects/projects-eclipse.html" rel="nofollow">Be sure to read this.</a> The documentation is pretty sparse but I was able to get it to work with it. Be careful to follow the section "Declaring library components in the the manifest file" exactly. </p> <p>So to refactor into a library you basically mark the existing project as a library project. You just have to tick a box in the projects settings (see the link).</p> <p>Now go to the library and we want to change the package name to something different. So for example if your released version package is com.mywebsite.myappname.android_market then I would rename this to com.mywebsite.myappname.common_code</p> <p>You can right click the Project and select Android Tools->Rename application package. This half worked for me. I also had to manually rename all references in the code to my R class manaully. You can just use a global search replace though to rename from com.mywebsite.myappname.android_market.R to com.mywebsite.myappname.common_code.R</p> <p>Now your library is ready</p> <p>Now time to make the actual project that you will build.</p> <p>Create a new android project and name with the package name for android market such as com.mywebsite.myappname.android_market. Follow the instructions on the link to add your new commons library as a library this package uses. </p> <p>One limitation with Android Library Projects is that the manifest of the library will NOT be merged into the manifest of your top level project. You need to paste it in there by hand. Also (see link) you need to make sure everything in your manifest uses fully qualified package names. So if you used to have activity names such as android:name=".SplashScreenActivity" change it to android:name="com.mywebsite.myappname.common_code.SplashScreenActivity"</p> <p>So again you need to merge everything by hand, including permissions, intents, activities etc.</p> <p>Now just build the top project and you are good. Make a wrapper for each variant that you want to build.</p> <p>You could also have these new top level projects implement anything that is different between your different versions. So your Android Market wrapper could implement one splash screen, and your Amazon version a different splash screen. Or you could just use an enum in your common project to drive it an keep both splash screens in there. </p> <p>Another nice feature is that resources in the top project will override resources in the library if they are provided. So if you want to for instance on your splash have an Amazon Version Logo and a Android Market logo that changes based on the version just use the same image name as in commons and put a different copy in the two versions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload