mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Fixing mangled commits that crept into this branch
This commit is contained in:
parent
c0474e811d
commit
49b76f5c71
20
bin/templates/cordova/lib/emulator.js
vendored
20
bin/templates/cordova/lib/emulator.js
vendored
@ -116,7 +116,7 @@ module.exports.list_images_using_avdmanager = function () {
|
||||
};
|
||||
|
||||
module.exports.list_images_using_android = function() {
|
||||
return superspawn.spawn('android', ['list', 'avds'])
|
||||
return superspawn.spawn('android', ['list', 'avd'])
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
@ -171,20 +171,10 @@ module.exports.list_images_using_android = function() {
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
if (forgivingWhichSync('android')) {
|
||||
return module.exports.list_images_using_android()
|
||||
.catch(function(err) {
|
||||
// try to use `avdmanager` in case `android` reports it is no longer available.
|
||||
// this likely means the target machine is using a newer version of
|
||||
// the android sdk, and possibly `avdmanager` is available.
|
||||
if (err.code == 1 && err.stdout.indexOf('android command is no longer available')) {
|
||||
return module.exports.list_images_using_avdmanager();
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
} else if (forgivingWhichSync('avdmanager')) {
|
||||
if (forgivingWhichSync('avdmanager')) {
|
||||
return module.exports.list_images_using_avdmanager();
|
||||
} else if (forgivingWhichSync('android')) {
|
||||
return module.exports.list_images_using_android();
|
||||
} else {
|
||||
return Q().then(function() {
|
||||
throw new CordovaError('Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?');
|
||||
@ -228,6 +218,7 @@ module.exports.list_started = function() {
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
// TODO: we should remove this, there's a more robust method under android_sdk.js
|
||||
module.exports.list_targets = function() {
|
||||
return superspawn.spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
|
||||
.then(function(output) {
|
||||
@ -399,6 +390,7 @@ module.exports.create_image = function(name, target) {
|
||||
});
|
||||
} else {
|
||||
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
|
||||
// TODO: there's a more robust method for finding targets in android_sdk.js
|
||||
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
|
||||
.then(function() {
|
||||
// TODO: This seems like another error case, even though it always happens.
|
||||
|
Loading…
Reference in New Issue
Block a user