mirror of
https://github.com/appium/appium.git
synced 2026-05-03 08:51:18 -05:00
update installAndroidApp to first uninstall app (fix #424)
This commit is contained in:
+14
-5
@@ -336,15 +336,24 @@ module.exports.buildAndroidApp = function(grunt, appName, cb) {
|
||||
};
|
||||
|
||||
module.exports.installAndroidApp = function(grunt, appName, cb) {
|
||||
var pkgMap = {'ApiDemos': 'com.example.android.apis'};
|
||||
if (!_.has(pkgMap, appName)) {
|
||||
var msg = "We don't know about appName " + appName + ", please edit " +
|
||||
"grunt-helpers.js:installAndroidApp() to add it and its " +
|
||||
"package identifier";
|
||||
grunt.fatal(new Error(msg));
|
||||
}
|
||||
|
||||
var appPath = path.resolve(__dirname, "sample-code/apps/" + appName,
|
||||
"bin/" + appName + "-debug.apk");
|
||||
exec("adb install -r " + appPath, function(err, stdout) {
|
||||
if (err) {
|
||||
grunt.fatal(err);
|
||||
} else {
|
||||
exec("adb uninstall " + pkgMap[appName], function(err, stdout) {
|
||||
if (err) return grunt.fatal(err);
|
||||
grunt.log.write(stdout);
|
||||
exec("adb install -r " + appPath, function(err, stdout) {
|
||||
if (err) return grunt.fatal(err);
|
||||
grunt.log.write(stdout);
|
||||
cb();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user