Can't use custom Android library I created. Package domain not defined



Hi everyone

I created a custom Android library following the guide at

When I try and run the code from nativescript, I get an error like “com is not defined”.
This “com” matches the com in the index.js of nativescript library.

var application = require("application");
var context =;

module.exports = {
    showToast: function() {
        var toaster = new com.example.Toaster();;

I am using tns version 3.4.0

Anything that I could be doing wrong? Is the guide outdated?