Skip to main content
Participating Frequently
February 29, 2012
Question

Can not include resources into apk

  • February 29, 2012
  • 1 reply
  • 2039 views

I'm trying to implement a Fortumo payment system as a native extension in the Android project.

The system comes as an external jar library.

When the application was packaged I saw that packager did not take classes from this library.

Solve this problem it was possible only if copy all classes from external library into my native library, and then package native extension and application.


But with the resources did not happen.

After package, the apk file in the root directory must have directory of resources of the payment system (fortumo_res). But I can put resources only in assets directory.

Can someone help me do this?

P.S. Maybe need change apk and then resign it? But so far I did not succeed to do it.




This topic has been closed for replies.

1 reply

Projectitis
Inspiring
March 1, 2012

Are you manually packaging your APK using the ADT tool?  If so, you can add resources to your package (and specify which folder they should go in to) by using the -C and -e options.

-e places a file or directory into a specific folder in your package

-C changes the current working directory on your development machine

Here is an example.  This will place the file 'asset.png' into the folder [package root]/lib/assets

adt [adt command here] -e "C:\\path\to\my\asset.png" "lib/assets"

You can also specify entire directories (recursively) instead of individual files.

Here is an example.  This will place the directory (and sub-directory) 'fortumo_res\assets' into the folder [package root]/fortumo_res

adt [adt command here] -e "C:\\path\to\fortumo_res\assets" "fortumo_res"

Or, you can place the 'fortumo_res' assets into the 'assets' package folder instead:

adt [adt command here] -e "C:\\path\to\fortumo_res\assets" "assets"

You can have as many as you like. Example:

adt [adt command here] -e "C:\\path\to\my\asset.png" "lib/assets" -e "C:\\path\to\fortumo_res" "fortumo_res"

Hope it helps!

Peter

Participating Frequently
March 1, 2012

Thank you. But this does not work for me. It put resources into apk/assets/fortumo_res, but I need apk/fortumo_res. Very strange.

Alexey.