APK builder

459 views
Skip to first unread message

Oreste Parlatano

unread,
Feb 8, 2017, 10:16:15 AM2/8/17
to DroidScript
I bought the APK builder, it worked fine during the first month, now each time I open DroidScript I have to reinstall the builder, because it is not more there by default. The built APK is no more installable, the size is half compared to the first month, with same scripts. Actually APK builder is no more useful.
Does anybody had the same experience ? Is there a solution ? I think DroidScript is the best tool because gives the possibility to develop the App with pure html5 + javascript, but APK builder is essential.

Oreste Parlatano

unread,
Feb 8, 2017, 10:52:13 AM2/8/17
to DroidScript
I receive always the following error: Parse error. There was a problem while parsing the package.

Symbroson Development

unread,
Feb 8, 2017, 11:03:04 AM2/8/17
to DroidScript
But you reinstalled the plugin right?

Netpower8

unread,
Feb 8, 2017, 11:03:58 AM2/8/17
to DroidScript
parse error could be a damaged file... try to reinstall again.

i have those kids of error before but now its ok.

can you give use more details ?

DS version number.
android os version number.
device ? (optional. could be hardware related. but rarely is)
procedure on how this occurred.

to give others here an idea on what went wrong

Oreste Parlatano

unread,
Feb 8, 2017, 11:13:08 AM2/8/17
to DroidScript
right, I have to reinstall it almost each day.

Oreste Parlatano

unread,
Feb 8, 2017, 11:21:32 AM2/8/17
to DroidScript
The entire code is hosted here: https://github.com/oresteafrica/saramoz_mobile

DS 1.42
Android 6.0
Device Wiko Smartphone Model Robby
Procedure: build APK -> try to install it on this phone but also to other tablets and phones -> message error: Parse error. There was a problem while parsing the package.

It was not happening up to few days ago. I am also performing a huge debugging, but the code is exactly the same as before, when it was able to build apk without any error.

Steve Garman

unread,
Feb 8, 2017, 11:46:43 AM2/8/17
to DroidScript
Normally I would assume this was a problem with insufficient storage causing the apk-builder plugin to not download correctly. I would recommend deleting anything on the device you can manage without, clearing the storage cache, powering off the device, restarting it and reinstalling the plugin.

However, if you are seeing exactly the same problem on multiple devices, that seems unlikely to be the problem.

A couple of questions.

Is the DroidScript project in which the code is held called saramoz ?

Are you sure there are no other files in the project except those in the git repository?

What package name are you using in the apk-builder dialog?

Oreste Parlatano

unread,
Feb 8, 2017, 11:54:23 AM2/8/17
to DroidScript
Is the DroidScript project in which the code is held called saramoz ?
Yes


Are you sure there are no other files in the project except those in the git repository?
There are xml files generated by the program itself through the javascript api app.WriteFile


What package name are you using in the apk-builder dialog?
saramoz

At the moment I am copying all files from github and performing a full debug, I cannot see anything wrong outside the code.

Steve Garman

unread,
Feb 8, 2017, 11:59:04 AM2/8/17
to DroidScript
saramoz is not a valid packageName. DroidScript should not be allowing you to build it.

Try changing the name in the apk-builder dialog to something like

com.myname.saramoz

Oreste Parlatano

unread,
Feb 8, 2017, 12:05:15 PM2/8/17
to DroidScript
Sorry you're right, the name is assigned automatically by DS, it is "com.myname.saramoz", (debug build), code not obfuscated, System Assets included

Steve Garman

unread,
Feb 8, 2017, 12:09:22 PM2/8/17
to DroidScript
Do any of the XML files have names that include characters other than the simple Latin characters a-z A-Z 0-9

Oreste Parlatano

unread,
Feb 8, 2017, 12:15:46 PM2/8/17
to DroidScript
It could, depends on the input from a html form. Input language is Portuguese, therefore ç, ã or other accented characters could appear in xml files. All generated characters are UTF-8

Steve Garman

unread,
Feb 8, 2017, 12:29:30 PM2/8/17
to DroidScript
As an aside, your app.WriteFile will not work in the installed app because they are trying to write to a read-only path within app.Path but this is not causing the problem you are describing.

In the project you are trying to build an apk from, are there any files with accented names, before you build the apk?

If there are, can you try renaming the files to unaccented names and see if it then builds a valid APK.

Oreste Parlatano

unread,
Feb 8, 2017, 12:30:04 PM2/8/17
to DroidScript
I also deleted all xml files, they are not essential for building apk, but nothing, the problem is still there, same error message. Generated apk file is 1.6 MB while before the problem DS was building an apk file around 3.0 MB. It seems like DS is not adding some relevant resources. Deflating apk is not possible with all usual tools, zip, 7-zip, unrar etc. Quite frustrating, but patience is all time required by developers.

Oreste Parlatano

unread,
Feb 8, 2017, 12:39:14 PM2/8/17
to DroidScript
Good to know about app.WriteFile, thanks. I'll move those xml files somewhere else.
File names are strictly [A-Z], [a-z], [0-9], just the content of xml files could contain accented characters.

Steve Garman

unread,
Feb 8, 2017, 1:40:40 PM2/8/17
to DroidScript
Struggling to see the answer to this.

Can you try running the code below in DroidScript (don't make an apk)

It should leave the result on the clipboard.

Please paste it into a reply here.

Steve Garman

unread,
Feb 8, 2017, 1:41:12 PM2/8/17
to DroidScript

function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
txt = app.CreateText( "Please wait",-1,-1,"multiline");
lay.AddChild( txt );

app.AddLayout( lay );

var fil,files, i; s="";
var path = "/data/user/0/com.smartphoneremote.androidscriptfree/app_Plugins/apkbuilder"
var lst = app.ListFolder( path,null,null,"fullPath" );
var len = lst.length;
for(i=0;i<len;i++)
{
fil = lst[i];
if( app.FileExists( fil ) )
{
s += app.GetFileSize( fil ) + " "+fil.replace(path,"")+"\n\n";
}
}
var lst2 = app.ListFolder( path+"/Uglify",null,null,"fullpath");
len = lst2.length;
for(i=0;i<len;i++)
{
fil = lst2[i];
if( app.FileExists( fil ) )
{
s += app.GetFileSize( fil ) + " "+fil.replace(path,"")+"\n\n";
}
}
txt.SetText( s );
app.SetClipboardText( s );
}

Steve Garman

unread,
Feb 8, 2017, 1:53:38 PM2/8/17
to DroidScript
It's possible that my code above may not produce any output.

If that is the case, please correct the path to the code below

//var path = "/data/user/0/com.smartphoneremote.androidscriptfree/app_Plugins/apkbuilder"
var path = app.GetPrivateFolder( "Plugins" )+"/apkbuilder";

Oreste Parlatano

unread,
Feb 9, 2017, 2:56:36 AM2/9/17
to DroidScript
Thanks Steve,

the result is blank, an empty screen, black color.
I used the apk builder for the program "Hello World", it produced an apk 2.6 MB perfectly working, I unzipped it with no hassles.
I am rewriting the code, probably I have to embed js code in html code, not using external js files. It seems that the problem is caused by the separation of html and js files.

Oreste Parlatano

unread,
Feb 9, 2017, 3:01:57 AM2/9/17
to DroidScript
Corrected, the result is:

1368 /ApkBuilder.html
628 /ApkBuilder.inc
49062 /ApkBuilder.jar
3 /Version.txt
24268 /amf.dat
2668848 /eng.dat
55056 /Uglify/consolidator.js
46300 /Uglify/parse-js.js
74656 /Uglify/process.js
2940 /Uglify/squeeze-more.js

Oreste Parlatano

unread,
Feb 9, 2017, 4:02:51 AM2/9/17
to DroidScript
Debugging all time, up to now it seems that apk builder does not cope with more than 10 image files, all png.

Steve Garman

unread,
Feb 9, 2017, 4:11:27 AM2/9/17
to DroidScript
Thanks for the details of the plugin. That looks valid.

As regards images, there is certainly no limit of 10 pngs. I regularly build an apk that contains 62 small PNG files, representing upper and lower case letters and digits.

Are the pngs very big?
Is the device on which you are building low on memory or storage?

Oreste Parlatano

unread,
Feb 9, 2017, 4:22:57 AM2/9/17
to DroidScript
I am using two devices Wiko Robby Smartphone and Lenovo 10 inches Tablet, both the same problem. Memory is good for both, with extra sd card 32 GB. 
I reduced the number of png files from 13 to 4, now apk is produced correctly, apk 3.2 MB.
The code is the same as before, average png size is 100 KB, with a maximum of 296 KB.
I modified only the number of png files below Img folder and is finally working.
Nightmare that is finally over ? I hope so.

Oreste Parlatano

unread,
Feb 9, 2017, 5:12:18 AM2/9/17
to DroidScript
I tried to convert images to base64. Now build apk get stacked.
Reply all
Reply to author
Forward
0 new messages