Multiple applications with different names for the same code base

后端 未结 5 671
无人及你
无人及你 2020-12-29 00:32

Reading this article, thought having the same problem - One code base, two applications on Android

I have created an application testApp that has items

相关标签:
5条回答
  • 2020-12-29 01:14

    I am not sure what you want exactly. But at my point of level, you can able to get the geo location, there you can find-out where you app currently running out, or in more easier get the location from locale, once you find the locale or geo-location, you can navigate the source according to that.

    0 讨论(0)
  • 2020-12-29 01:16

    For this you have to use App Localization concept. For this you have to create different resources, durables. Let say You want to run your application in japan, you have to create drawable folder like "res/drawable-ja". This is same as you create different layouts to support tablet and small devices. here is reference link: http://developer.android.com/guide/topics/resources/localization.html http://developer.android.com/distribute/googleplay/publish/localizing.html

    0 讨论(0)
  • 2020-12-29 01:26

    The way to have multiple apps from a common code base is to have the common code as a library project, and have each app use the library project (see http://developer.android.com/tools/projects/index.html). Each project can override strings.xml, and the common come can check the package id.

    In your case it seems that this is against the Google Play policy (cookie cutter apps), so it may be better to create one app and let the user choose a country.

    0 讨论(0)
  • 2020-12-29 01:31

    I had similar problem with putting project to different markets - Google Play, Samsung, Amazon. All code base is the same, difference only in billing code.

    The best solution I found is creating separate project for each market and pushing common code into library project.

    In more detail, you need to leave common code in main project, make it library project and enable manifest merger for library and child projects. Add following lines to project.properties of main project:

    android.library=true
    manifestmerger.enabled=true
    

    and this to project.properties of every child project:

    android.library.reference.1=../testApp //absolute or relative path to your main project
    manifestmerger.enabled=true
    

    Also you need to attach main project as library in ADT plugin (in Eclipse - project properties -> Android) to all child projects. Main project manifest should not contain any launcher activity, it will be ignored, same thing with appWidget xml's and config activities, if you have some.

    In child projects you can configure whatever you want and use main code by extending or just using needed classes as normal Java library. Also, you can use main project activities, services, broadcast receivers, etc just as they are in your child project without any duplication of manifest of child projects. After all configured, you can just build needed project for needed country as usual single project and you would have different apk's for different countries, as you want.

    Here is more detail description of manifest merging http://www.platoevolved.com/blog/programming/android/merging-android-manifest-files/

    Note, this feature was added in ADT version 20 preview 3.

    Hope this helps.

    0 讨论(0)
  • 2020-12-29 01:34

    I had this same question. Maybe you have found the answer at this point, but some searching finally led me to this website, which explains Gradle.

    It seems to explain all the basics really well. For the answer to your specific question, look for the section Product Flavors under Build Variants.

    As the website explains, part of the purpose behind this design was to make it more dynamic and more easily allow multiple APKs to be created with essentially the same code, which sounds exactly like what you're doing.

    I probably didn't explain it the best, but that website does a pretty good job.

    0 讨论(0)
提交回复
热议问题