Ignoring the fact that there is no promise this hack will work in the future, doing this is also telling the platform that your app relies on ARM code so it will not be available to devices running with other CPUs whenever those appear.
Why do you need to do this? If you need the data as an uncompressed file for random access and such, it is more efficient to store it uncompressed in the .apk use the API to retrieve an fd and offset to the file for reading. Otherwise you have to install on the user's device both the compressed and uncompressed versions of the file. On Thu, Oct 21, 2010 at 8:10 AM, Jonathan Pryor <[email protected]> wrote: > I'm writing an application and would like to have some files extracted > from the .apk during _installation_ time, as the files can be quite > large and extracting them from the .apk during the first run results in > a noticeable slowdown which I would prefer to avoid. > > After lots of experimentation, I have found one way to make this work, > but I'm unsure about the "long-term" ramifications of this approach, > specifically: will this actually work in android-9 and later? > > The approach is to name the files I want extracted at installation time > as "lib*.so", and place them into the appropriate lib/ABI folder within > the apk file, e.g. the .apk contains: > > lib/armeabi/libMyLargeFile.dat.so > > and at installation time this is (nicely) installed as: > > $APPDIR/lib/libMyLargeFile.dat.so > > My concern is that 'libMyLargeFile.dat.so' is NOT an ELF shared library. > This approach only works because PackageManagerService only checks for > files matching the `lib/ABI/lib*.so` pattern (which is followed) and > does not check the contents of the extracted file. > > This approach works for Android 1.6 through Android 2.2. I'm wondering > if this will continue to work in the future, or if I need to investigate > an alternate mechanism. > > Thanks, > > - Jon > > P.S. On a related note, I did see android.app.backup.BackupAgent, which > says "Restore operations are typically performed only when applications > are first installed on a device." Unfortunately, this type is only > supported in Android 2.2, and even when I > specify /manifest/application/@android:backupAgent my BackupAgent isn't > ever instantiated, never mind "when...first installed on a device," so > the docs appear to be misleading or I'm missing some other crucial > undocumented step. > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

