Notices


Reply
Thread Tools
Posts: 233 | Thanked: 491 times | Joined on Oct 2011 @ Sydney
#1
So you may have seen this thing called apkenv, which allows a very "small" set of Android apks to be run inside Harmattan.

If you follow me on Twitter, you would have seen I have been doing some experimental packaging, make these apks appear to be fully fledged apps (launcher icon, app mgr info, tap>hold>uninstall, etc).

NOTE:This method still requires you to install apkenv+libraries before you can use the apps you make. It also will work assuming you followed the original tutorial EXACTLY! I also assume you use linux (I use ubuntu VM ).

Obviously, I do not condone publishing apks for those you do not have the right to use, so I will simply post a tutorial using a skeleton archive (attached) to help.

First up, extract the archive to the desktop.

Rename the folder to whatever you wish to call the app. (Will call it foobar from here-in).

Inside foobar there is a debian folder, opt folder and foobar.desktop. First, we will modify the opt folder.

In the opt folder, you should have a sub directory foobar. This is where you store your .apk, icon.png (80x80), and execution script. The execution script isn't too important if you are confident at running command using the foobar.desktop file. However, I still suggest using this method, as it has greater control over tasks in my opinion.

Once you have opt/ all sorted, it is time to move on to the debian directory. Inside this we have postinst , changelog, control, foobar.install, mainfest.aegis, readme and rules. The only files you need to edit are postinst, changelog, control and foobar.install.

Open foobar.install in a text editor, changing the paths used to suit the /opt of your app. Same goes for postinst, simply adjust the paths to suit your package.

Changelog simply change foobar and the author information. In control, change the Description, Maintainer, source, package and x-Maemo-Display-Name fields. Everything Else can stay the same.

Finally, edit the foobar.desktop file. Here, we control what the user sees on the launcher page. The icon and exec fields simply need to have their paths altered. Change Name= to the name you want displayed.

P.S: I simply re-use the same structure for all my packaging (due to my app's being scripts and not QML/GUI based) so you may see out of place names eg. Harmoji, ABSapce etc. If so, I apologise, I have triple checked everything but I could have missed something. I trust if you're skilled enough to be doing this sort of thing, you will have the logic to change them accordingly.

Next, is compiling the deb.

To compile, I suggest you take a look at this guide. It is extensive, and helped me out once.
http://talk.maemo.org/showthread.php?t=80908

Huge thanks to NovaG for being the first to teach me how to package .deb files.
Attached Files
File Type: zip foobar.zip (8.8 KB, 150 views)
__________________
Blogs I post to
MyNokiaBlog
UnleashThePhones

Hit thanks if I have helped in some way, or you agree with me

Twitter
-------------------------------------------------------------------------------
Battery Widget
#OperationUnicorn
Harmoji - Emoji for Harmattan

-------------------------------------------------------------------------------
N9 [Black] - Sailfish OS (1.x.x.xx)
N9 [White] - PR 1.3 [Stock]
N950 - Sailfish OS
Z10 LE - 10.2.1.1055
Dev Alpha C - 10.2.1.1055

Last edited by MFaroTusino; 2012-10-27 at 10:38.
 

The Following 11 Users Say Thank You to MFaroTusino For This Useful Post:
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#2
Is that _MACOSX folder is necessary in the package?
 
Moderator | Posts: 6,214 | Thanked: 6,388 times | Joined on Nov 2011
#3
Originally Posted by AJMAL P.M View Post
Is that _MACOSX folder is necessary in the package?
No its a default folder mac puts in for its own indexing...
 

The Following 2 Users Say Thank You to thedead1440 For This Useful Post:
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#4
There is something wrong with the archive. (May be not.) I had to do two things to make a successful deb.

1) When I tried with exact similar archive it showed dependency error. With modified control file in the archive I got installation interrupted error.

(Then I tried your angry birds control elements with modification.)

2) desktop file moved to /usr/share/applications

BTW I tried deb packaging on N9 not Pc.

PS: there is a hidden unwanted DSstore file too in that archive may be from your system. Easy to confuse people like me.
 
Moderator | Posts: 6,214 | Thanked: 6,388 times | Joined on Nov 2011
#5
Yes DSstore is not required too...

Maybe you want to post what you have done?
 
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#6
Yup sure. Wait a little. Writing... Now saved game datas are working seperate for each games. You can reboot/play another game without fear of losing saved datas.
 
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#7
All right. Here is it. Wrote it with people like me in mind. You might know most of the part. Still have a read. I don't have an N900 but I think the steps are working for N900 too.

Install apkenv and binaries from apkenv wiki page or from here. Strongly recommend you to put apkenv and binaries in /home/user/apkenv.

With apkenv you can run android games on your N9/N900. You will lose game datas after every boot or you will lose previously played game's datas when you try another game. To run an apk execute

Code:
cd /home/user/apkenv

./apkenv /path/to/your/apk
Only a few games are working. Consider it as a beta release. Lets pray for the future developments and improvements from the dev, thp.

Now download scripts.zip and extract. It contains apkenvwrp.sh and make-deb.sh. Open terminal or filebox. Create a folder .apkenvwrp in /home/user/ and copy apkenvwrp.sh to the folder created.

Code:
mkdir -p /home/user/.apkenvwrp

cp -r /path/to/downloaded/apkenvwrp.sh /home/user/.apkenvwrp

chmod +x /home/user/.apkenvwrp/apkenvwrp.sh
This script will allow you to save/load game datas seperately. So you won't lose it after a reboot or after playing another game.

To run apk files with apkenvwrp script. Execute it like

Code:
cd /home/user/.apkenvwrp

sh apkenvwrp.sh /path/to/your/apk
Always use the above method to run an apk to avoid losing saved game datas. Here ends the apkenv part. Now lets move on to deb packaging on your N9/N900 if you are interested. You can forget the terminal for ever once you installed a game in this way. (Only a few changes from the apk to deb tutorial by MFaroTusino. Main focus is on deb packaging.) You can skip this deb packaging tutorial and read my next post on this thread to find an easy way to launch apks from launcher view with saved game datas.

TUTORIAL: Deb Packaging

Let's do some necessary things first. Hope you still have the downloaded scripts.zip file. Extract it and get make-deb.sh

Code:
devel-su
enter password

cp -r /path/to/downloaded/make-deb.sh /usr/bin/make-deb

chmod +x /usr/bin/make-deb

apt-get install binutils

exit
As an example we are going to pack the foobar archive as deb. Download foobar.zip from attachments. You don't have to edit anything as of now in this example package. But You have to replace every foobar occurence with your name when you try another file. (replace folder name, file names, and edit the file inside folders using text editor. Just replace foobar with your name.)

Extract foobar.zip. You will get a foobar directory. Inside are 3 sub folders named DEBIAN, opt and usr. Inside DEBIAN you have a control file and postinst file. Inside opt there is a foobar folder and inside it you have an 80x80 icon file, and an apk file. Inside /usr/share/applications/ you will find foobar.desktop.

Steps for Deb Packaging

1) Copy the foobar directory to /home/user/

Code:
cp -r /path/to/foobar /home/user/
If you get error try without root access. If still having error try /usr/bin/ instead of /home/user/

2) Give read and execute permission to DEBIAN and content inside it.

Code:
chmod 755 /home/user/foobar/DEBIAN/

chmod 755 /home/user/foobar/DEBIAN/*
3) Now let's make the deb

Code:
make-deb /home/user/foobar
4) Copy the created deb to desired location using filebox or terminal.

Code:
cp -r /home/user/foobar_0.1.deb /home/user/MyDocs/
Now you know how to make a deb in easy steps. Please note that the foobar.apk we have in /foobar/opt/foobar/ is just a dummy file. It won't work with apkenv in either way. Download an android game which is working with apkenv. Lets say Angry Birds Rio. Rename the file to AngryBirdsRio.apk and replace the foobar.apk with it. Now rename all folders and files named foobar to AngryBirdsRio. Using a text editor replace all occurrence of foobar with AngryBirdsRio in control, postinst, and AngryBirdsRio.desktop files. Save the changes. Then follow the deb packaging step. Install the deb you created. That's it. Now onwards tap icons and play the games right from launcher view without fearing data loss. Cheers!

If you have any confusion feel free to ask. All the informations are taken from various TMO threads. Credits go to the respective authors with my respect.

Credits
apkenv: thp
apkenvwrp.sh: PIDk
deb packaging: ammyt, Zas
make-deb script: Zas
apk to deb tutorial: MFaroTusino
Attached Files
File Type: zip scripts.zip (1.1 KB, 87 views)
File Type: zip foobar.zip (10.8 KB, 78 views)

Last edited by AJMAL P.M; 2012-11-02 at 03:01.
 

The Following 2 Users Say Thank You to AJMAL P.M For This Useful Post:
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#8
For you people who said Angry Birds Seasons is not working. Try it with apkenvwrp.sh script described above. It will work!

cd /home/user/.apkenvwrp

sh apkenvwrp.sh /path/to/angrybirdsseasons.apk

And for those who want an icon in launcher view but don't want to do deb packaging or don't want to lose some storage sapce just make a desktop file with path to icon and exec=sh /home/user/.apkenvwrp/apkenvwrp.sh /path/to/your/apk


EDIT: Incase of extreme laziness, I have attached a sample desktop file. Edit it and place it in /usr/share/applications to launch your apk.

devel-su
password

cp -r /path/to/your/desktop /usr/share/applications
Attached Files
File Type: zip sample_desktop.zip (256 Bytes, 72 views)

Last edited by AJMAL P.M; 2012-11-01 at 07:40.
 
panjgoori's Avatar
Posts: 1,210 | Thanked: 1,227 times | Joined on Aug 2011 @ Balochistan
#9
what about N900 ? Will this guide work for it also or just harmattan ?
 
Posts: 95 | Thanked: 35 times | Joined on Feb 2012
#10
Originally Posted by panjgoori View Post
what about N900 ? Will this guide work for it also or just harmattan ?
Everything is said to be working with N9 and N900. I do not have an N900. Trying won't make any harm I guess.

Atleast I can say apkenvwrp part is working for both N9 and N900 for sure. You can read this thread for complete deb packing on N900.

Last edited by AJMAL P.M; 2012-11-01 at 09:37.
 

The Following User Says Thank You to AJMAL P.M For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 16:11.