Android app doesn't retrieve file names after modifying and recompiling package
Mark Schonewille
m.schonewille at economy-x-talk.com
Sun Nov 2 10:31:15 EST 2014
Hi,
Because I have to display Vimeo videos in a project of mine for Android,
I followed the instructions at
http://quality.runrev.com/show_bug.cgi?id=10267 to decompile my app,
change the manifest file, recompile the app, and sign it. Unfortinately,
the resulting apk is worse than the original.
I have "updated" an old Mac to Mac OS X 10.7.5. I have installed JDK
1.7.0_72 on this Mac. I'm trying use a LiveCode standalone application
on my old Android tablet with Android version 2.3.3.
The unmodified standalone, built with the option "sign for development
only" runs fine on my tablet, but video won't display.
First, I built the app for Android, using LiveCode 6.6.2 for Windows.
Then I copied it over to my Mac. I used
$ java -jar apktool.jar decode /Volumes/Macintosh\
HD/Users/Mark/Desktop/apk\ tool/MyApp.apk app
to decompile the apk file. It appeared in a folder with the name "app"
in my Home directory, with sub directories:
app
AndroidManifest.xml
apktool.yml
assets/
doc/
links.txt
pic/
vid/
Demos/
Examples/
Other/
Simple Animation.mp4
Vimeo Pro Example.html
Tutorials/
SQL.html
build/
lib/
res/
smali/
The contents of the assets folder is included by LiveCode's standalone
builder. I created all of these files and folders during project
development. The folders in the vid folder contain several HTML files
and one mp4 file. I have listed only a few of the html files in the file
tree.
I changed the AndroidManifest.xml by replacing the line
<application android:label="MyApp" android:debuggable="false">
with
<application android:label="MyApp" android:debuggable="false"
android:hardwareAccelerated="true">
After this, I rebuilt the app, using apktool again. I used sudo, because
here http://quality.runrev.com/show_bug.cgi?id=10267 it said I had to
use sudo:
$ sudo java -jar /Volumes/Macintosh\ HD/Users/Mark/Desktop/apk\
tool/apktool_1.5.2.jar b -a /Volumes/Macintosh\
HD/Developer/android-s-d-k-mac_x86/platform-tools/aapt
It appears that if you use sudo once, you have to use sudo all the time.
So, now I had to sign it using
$ sudo jarsigner -verbose -sigalg SHAwithRSA -digestalg SHA1 -keystore
/Volumes/Macintosh\ HD/Users/Mark/app/dist/MyApp.apk myalias
I verified that it was signed and changed the name of the file then
aligned the file
/Volumes/Macintosh HD/Users/Mark/app/dist/MyApp.apk
to
/Volumes/Macintosh HD/Users/Mark/app/dist/MyApp_unaligned.apk
I aligend the file using
$ zipalign -v 4 /Volumes/Macintosh\
HD/Users/Mark/app/dist/MyApp_unaligned.apk /Volumes/Macintosh\
HD/Users/Mark/app/dist/MyApp.apk
This file should work on my Android tablet. I'm able to start and run
the file, but my app doesn't see any of the files in the subfolders of
folder vid/, except for Simple Animation.mp4. However, it _does_ notice
that there are files. A repeat loop that checks all folders in folder
vid/ for files creates a list, but the lines in the list are empty, one
line for each file, meaning that it can't figure out what the name of
the files is. Needless to say, I checked that all files are included in
the new apk file.
What may cause this?
If you wonder about the file paths: I started my Mac from an external
disk and used the files on the internal disk. So, /Volumes/Macintosh HD
isn't the system disk here.
You can also read this at or at http://qery.us/hv0 where I have posted a
test file or at http://stackoverflow.com/q/26700856/807423
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
Installer Maker for LiveCode:
http://qery.us/468
Buy my new book "Programming LiveCode for the Real Beginner"
http://qery.us/3fi
LiveCode on Facebook:
https://www.facebook.com/groups/runrev/
More information about the use-livecode
mailing list