app-inventor: install apps onto SD card

2020-04-14 09:50发布

问题:

[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:

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

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

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">

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

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.

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:

The signed application is available for download here.



回答2:

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



回答3:

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