User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

plugins:building_an_apk

This is an old revision of the document!


Building an APK

The DroidScript ApkBuilder plugin allows you to export your apps to standard Android Package files (APK files). You can then distribute your apps to your friends or upload your them to Google Play for the whole world to try!

Usage

Once the ApkBuilder plugin is downloaded, you can create APK files by long pressing on your app icon in DroidScript and selecting the 'Build APK' option.

File paths

It is important to use relative file paths in your JavaScript source code to load images, sounds and external scripts etc, because these files are copied into the APK file as internal assets during the build process. Remember the “/sdcard/DroidScript” folder will probably not exist on someone else's mobile device.

So you should do this:-

img = app.CreateImage( "Img/myface.png" );

not this:-

img = app.CreateImage( "/sdard/DroidScript/MyApp/Img/myface.png" );

Extracting assets

If your app is running a web server or streaming video from assets, then you will need to extract these assets from your APK to the internal sdcard when your app is first run. These assets can then be served/streamed from the there instead, because assets cannot be served or streamed from inside an APK.

Another reason you might want to extract assets to the device's internal sdcard, is when you need to modify them in some way or allow the user to modify them at run time. For example you might have a template settings file or database file that should be extracted when the app is first run. You can handle the extraction of assets using the app.IsNewVersion() and app.ExtractAssets() methods.

Using a build.json file

If you create a file called 'build.json' at the top level of your project, then you will be able to control certain aspects of the build process, such as the 'minSdkVersion' setting in the manifest, which sets the minimum version of Android that your app will run on.

{
	"manifest" : 
	{ 
		"minSdkVersion" : 18,
		"targetSdkVersion" : 21,
		"debuggable" : false,
		"removePermissions" : "WRITE_EXTERNAL_STORAGE, ACCESS_WIFI_STATE",
		"homeScreen":false,
		"pathPattern":".*\\.jpg,.*\\.txt"
	}
}
plugins/building_an_apk.1482414608.txt.gz · Last modified: 2016/12/22 21:50 (external edit)