2

[edited to show current state of play a week after asking the question]

I delved into app inventor because my kids (age 10 and 12) are about to get their first android phones, and have done some drag and drop programming (game maker) so I thought it might be a good entry point for them.

I have now written 5 apps myself with app inventor, and installed 4 onto my phone, and I can't install the 5th one because I am "out of memory" apparently, despite having 3 gigs free on the SD card on the phone.

Ok so what is going on? Settings->Applications->Manage Applications doesn't cut it, because the "Move to SD card" option is greyed out on the appinventor apps.

I packaged up my 5th app as an apk, and then unzipped it to look at AndroidManifest.xml but it's not plain text :-/

Solutions that are not a good fit for me:

(1) "Wait"

(2) "Root your phone and then..."

(3) "delete some stuff from your phone memory" [a work-around, not a solution]

(4) "Buy this product and then..."


OK so here's an update. I still have not managed to solve this problem. Here is what I did so far.

1) I created, in appinventor, an application called "test123", with a picture and a button (which does nothing).

2) I created an apk, and stuck it on my website: you can see it at this link . Anyone who wants to can download it and run it on their phone, as long as they have 4 or so megs of free memory on their phone. As far as I know they can't download it onto their SD card. So let me clarify that the challenge is to get that app, the one in the link, installed onto a phone SD card.

OK so let's try!

3) I put the apk on a linux box, downloaded apktool, and ran

apktool d test123.apk

After a little bit of baksmaling, I now had a directory test123 .

4) I moved into directory test123 where I found a file AndroidManifest.xml . I edited this file; the first few lines were

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="3" android:versionName="1.5" package="appinventor.ai_************.test123"
  xmlns:android="http://schemas.android.com/apk/res/android">

[I have censored my gmail address with ***s]

and I changed them to

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="3" android:versionName="1.5" package="appinventor.ai_************.test123"
  xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal">

5) I moved into the directory where the old apk was (i.e. the directory containing the directory test123) and typed

apktool b test123

After some smaling, the program terminated.

6) I changed into directory

test123/dist

and in it I found a new .apk file, also called test123.apk . I put it on my website here . Note that both the "before apktools" and the "after apktools" versions of the apk have exactly the same name -- test123.apk .

7) I now downloaded the "after" file -- the version created by apktool b -- onto a Windows machine, and opened it with 7-Zip (switching to Windows was just so I could use the precise program suggested in the answers). I can't find the files that it has been suggested that I delete though. I see

AndroidManifest.xml
classes.dex
resources.arsc
assets/smallkez.png
res/drawable/ya.png

and that's it.


In summary then, I seem to be failing at step 5 of DarkXphenomenon's solution (at the time of writing). If I download the "after" file onto my phone, and try to install it, I get the incredibly informative error "! Application not installed" and my only option is to click "done".

Unfortunately I still don't know whether I am trying to do the impossible, i.e. whether googling around is leading people to solutions which used to work but no longer do, or whether I am just missing something stupid.

This is such a fundamental issue for me! My phone, out of the box, has about 21 megs of free memory, and my sd card has gigabytes and gigabytes.

1
  • DarkXPhenomenon's answer shows where I was going wrong. After repackaging the apk with apktools, it needs signing. I managed to sign with sign+ and now I have an appinventor app installed on my SD card. Many thanks DarkXPhenomenon. Jul 15, 2012 at 16:54

3 Answers 3

4

The issue itself: The move to sd card option is grayed out.

Issue

Solution:

Currently, app-inventor itself does not support the install to external SD feature yet. So, the issue you face is an app that shows this.

This approach does work. I tested it! I am also uploading all the tools I used to my Google Drive account for ease of download.

test_orig.apk is the original file from app-inventor.

Step 1. Decompile the APK using apktool. It can be done under windows, using apktool. This is the archive I used under windows. The sources need not be decoded to edit the manifest. Hence, the command used is apktool d -s test_orig.apk

Decompilation

Step 2. This creates the folder named test_orig in the same directory containing apktool. Within this directory is the folder AndroidManifest.xml. Open that up in a text editor and change the following line.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"  ...android:installLocation="preferExternal">

Change Manifest

Step 3. Time to recompile the apk using apktool b test_orig Recompilation

Step 4. Now, it is time to sign it. Signing it is made easy using Sign+. Just add the apk and it will spit out a signed copy. Nothing else needs to be done.

Signing

Step 5. Your signed apk is ready to be installed. Remember to uninstall your old apk or you will see an error that says Application Not Installed: An existing package with a conflicting signature exists.

END Result:

End

The signed application is available for download here.

14
  • This answer is clearly well on the way to winning the tick, but it has not done the trick for me yet. Firstly, either there's a typo in what you write above or I'm misunderstanding something: "apktool -s xyz.apk" is a syntax error and I think we want "apktool d -s xyz.apk". Secondly, there's no mention at all of android:installLocation in AndroidManifest.xml . I changed the second line of the xml file from '<manifest blah' to '<manifest blah android:installLocation="preferExternal"'. Thirdly, I put it all together again, tried to install on the phone and got "application not installed" error:( Jul 11, 2012 at 9:25
  • apktool d xyz.apk should work right. I have changed my answer. Should work now. Jul 11, 2012 at 9:52
  • 1
    @KevinBuzzard When you got "application not installed" did you have a previous version of the apk installed on the device? If so try without, it is possible that the two apk's were signed with different keys which would result in this error.
    – FoamyGuy
    Jul 11, 2012 at 13:12
  • @Tim: yes, possibly! Will get back to you when have time to think about apps despite having 3 kids :-/ Jul 11, 2012 at 23:20
  • OK, still struggling :-/ I made a new dummy app which just displayed a picture. I did steps 1--4 . I am assuming that the new apk is the one that appears in the dist subdirectory of the folder that appears when I unpack the old apk. But opening (or even unzipping) this with 7-zip seems to indicate no META-INF folder. Has anyone else managed to actually get this to work, by the way? Jul 13, 2012 at 19:43
1

It seems like that is a known issue:

http://code.google.com/p/app-inventor-for-android/issues/detail?id=186

Someone in this thread is saying that they found a solution, but if I had to guess I would guess that the solution they used was before the manifests were obfuscated within the apk files.

Unfortunately I think there is no (easy) way to move the apps to the SD card at this time.

It is probably worth posting this issue on the MIT app inventor forums

4
  • Yes, this is a known issue, but it seemed to me that asking how to get around it on that thread would not be as fruitful as asking how to get around it on this forum! Tim -- what do you think of DarkXphenomenon's idea to use apktool? I haven't got it to work yet but do you think it sounds plausible? I don't know whether to persevere with it or wait for some more comments/answers. Jul 11, 2012 at 9:27
  • it does seem plausible to me, but I've never tried so I couldn't say for sure.
    – FoamyGuy
    Jul 11, 2012 at 13:11
  • I've finally found the time to try it, and I failed :-/ I am slightly surprised that this is not higher priority to more people. Or does no-one use appinventor?? How are other geeky 10-year-olds writing android apps?? Jul 15, 2012 at 10:15
  • @KevinBuzzard I love the idea of AppInventor. I've only used it a few times, but It would definitely be what I used if I was working with children of that age. If they managed to get it to where you could build with AppInventor and then import the project into eclipse and make changes to it I would be all over it. Because this is not possible yet I think it is mostly limited to an educational setting, and most the time I think issues such as moving app to SD card are of little concern. However I do think it is a very good question, and I hope DarkXphenoms new answer solves it for you!
    – FoamyGuy
    Jul 15, 2012 at 15:27
1

I need to hang here more often...

There are two third party apps that let you edit the mainfest. They do what you were working on by taking the apk apart and getting the manifest so you can edit it.

I put up a new version of ai4a App Inventor http://sourceforge.net/projects/ai4a-configs/files/V1.2/

It saves the manifest in your temp folder where you can edit it and then rebuild the apk with your edited manifest. I have not tested installing onto the sd card (I put some App Inventor apps on Google TV just to see it work ;-)). Be sure to let us know if you try it the ai4a server.

Here is where we are talking about the server https://groups.google.com/forum/?hl=en#!forum/ai4a

and here is support https://groups.google.com/forum/?hl=en#!forum/usgsuacwai

Gary

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.