This is a migrated thread and some comments may be shown as answers.

AppBuilder-CLI wrong avd (android) image argument

1 Answer 15 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Igal
Top achievements
Rank 1
Igal asked on 28 Sep 2014, 07:15 PM
Hay, I tried using the AppBuilder-CLI on my Linux like this inside project directory:
$ appbuilder emulate android

got error image "cannot be found".

so I looked into appbuilder code, specifically:
/usr/lib64/node_modules/appbuilder/lib/commands/emulate.js

and found this code:

var EmulateAndroidCommand = (function () {
    function EmulateAndroidCommand($project, $projectTypes, $buildService, $androidEmulatorServices) {
        this.$project = $project;
        this.$projectTypes = $projectTypes;
        this.$buildService = $buildService;
        this.$androidEmulatorServices = $androidEmulatorServices;
    }
    EmulateAndroidCommand.prototype.execute = function (args) {
        var _this = this;
        return (function () {
            _this.$androidEmulatorServices.checkAvailability().wait();

            var tempDir = _this.$project.getTempDir("emulatorfiles").wait();
            var packageFilePath = path.join(tempDir, "package.apk");
            var packageDefs = _this.$buildService.build({
                platform: MobileHelper.DevicePlatforms[1 /* Android */],
                configuration: "Debug",
                showQrCodes: false,
                downloadFiles: true,
                downloadedFilePath: packageFilePath
            }).wait();
console.log(args[0]);
            var image = args[1];
            var appId = AppIdentifier.createAppIdentifier(MobileHelper.DevicePlatforms[1 /* Android */], _this.$project.projectData.AppIdentifier, options.companion, _this.$project.projectType);
            _this.$androidEmulatorServices.startEmulator(packageFilePath, { image: image, appId: appId.appIdentifier }).wait();
        }).future()();
    };
    return EmulateAndroidCommand;
})();

looking ahead, it turn out the command I was looking for is actually:
$ appbuilder emulate android Emu1

but, my image is in args[0] not args[1].
so I made the following change, var image = args[0]; and the correct emulator showed up running the same command.
I will also note there's no documentation of this not in application help and not the Telerik site.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 29 Sep 2014, 12:55 PM
Hi Igal,

The officially supported workflow for the CLI is to use only the default emulator.

As you found out, however, there is code which slipped through and can be changed to support running on a particular emulator image. In its current state, this code is unfinished and that's why it is undocumented.

Your change makes it work, but this is only a temporary measure. You can use it but we cannot guarantee its stability. We plan to implement this feature more thoroughly for our next release. If this happens, the feature will also be tested, fully supported and well documented.

In the meantime, I would like to thank you for bringing it to our attention. As a small token of our gratitude I updated your Telerik points.

Regards,
Todor
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Report a bug
Asked by
Igal
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or