13

Is there anyway to create dynamic apk.ie suppose we have a main site and it has many subdomains.Each subdomain should have there own customized apk containing their own customized logo,news etc.

Is it any way to create apk other than creating individual apk for each site?

H.Muster
  • 9,297
  • 1
  • 35
  • 46
KP_
  • 1,854
  • 25
  • 43
  • 1
    [Answers in this discussion](http://stackoverflow.com/questions/10143352/eclipse-multiple-project-from-single-source) may give you some clue. – yorkw Sep 07 '12 at 09:27
  • What element of the apk needs to be dynamic? as @MadeInChina suggested, maven or ant could do what you want but there may be a better way. – Ben Neill Sep 13 '12 at 09:38
  • You say "any way to create apk other than creating individual apk" - do you possibly mean you want to create multiple different icons, but with only one apk? – Stobor Sep 14 '12 at 00:12
  • @Ben Neil , i think using maven or ant ,we can create it at run time .But is there any other way? – KP_ Sep 14 '12 at 09:51

4 Answers4

5

You can compile your code dynamicaly by java code using for example maven or ant. To do that you need you have to make your Android project be maven project. To compile Android using maven I use maven-android-plugin. Than you can just run some thing like mvn package or from java code and wait until maven compiles you code with customized logos that you need. And you will have an apk in target directory.

Nikolai Samteladze
  • 7,699
  • 6
  • 44
  • 70
alexandr.opara
  • 454
  • 2
  • 7
5

Why create a custom APK? Why not download the content that needs to be customized?

Anyways, you can share resources from different APKs using a sharedUserId and getResourcesForApplication() (link). You would still need to make each an APK.

Some info from Roman Nurik:

Share files between applications

If your apps are signed with the same certificate and have the same android:sharedUserId declared in the manifest, they can share data in that they can read/write to each others' data directories. They can even share a process if you'd like them to (see android:process).

More links to similar questions:

Community
  • 1
  • 1
pjco
  • 3,826
  • 25
  • 25
  • Also found this link which may be helpful: **Custom Class Loading in Dalvik** http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html – pjco Sep 26 '12 at 19:01
3

There is no other way than creating individual apk for each site. Apk files are signed by jarsigner and as is written in documentation:

The signed data cannot be changed; if it is, the signature will no longer verify as being authentic.

And additionally:

All applications must be signed. The system will not install an application on an emulator or a device if it is not signed.

That what you can do is create script or use ant or maven to build set of apks with different content.

pawelzieba
  • 16,082
  • 3
  • 46
  • 72
3

Build it with ant or maven,then you can config the params such as logo icon

MadeInChina
  • 130
  • 6
  • i think using ant or maven,we can dynamically create it at runtime.But is there any other way? – KP_ Sep 14 '12 at 09:49
  • dynamically create maybe is the best way.but you can decode the apk,then you can replace resources with what you want. – MadeInChina Sep 14 '12 at 09:59