async function resolveToOfflineEmulator ({ id: avdName, type }, { apkPaths }) {
    if (type === 'device') return null;

    if (avdName) {
        if (!await isEmulatorName(avdName)) return null;
    } else {
        events.emit('verbose', 'Looking for emulator image that best matches the target API');

        const targetSdk = await getTargetSdkFromApk(apkPaths[0]);
        const bestImage = await emulator.best_image(targetSdk);
        if (!bestImage) return null;

        avdName = bestImage.name;
    }

    // try to start an emulator with name avdName
    const emulatorId = await emulator.start(avdName);

    return { id: emulatorId, type: 'emulator' };
}
@param {TargetSpec} spec
@param {BuildResults} buildResults
@return {Promise<Target>}