1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Fix pre-Lollipop (21) Android debug

Namely, automatically pick debug over Wi-Fi for devices with an older release and debug over USB otherwise.

A message is printed both in editor output window and console (uppercase here) to let the user know about what mechanism is being used and why.

Fixes #10458.
This commit is contained in:
Pedro J. Estébanez
2017-08-30 20:03:47 +02:00
parent 8d49cdcfeb
commit d6d1c55505

View File

@@ -1596,7 +1596,11 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
//export_temp //export_temp
ep.step("Exporting APK", 0); ep.step("Exporting APK", 0);
p_flags |= EXPORT_REMOTE_DEBUG_LOCALHOST; // Needed for adb reverse const bool use_remote = (p_flags & EXPORT_REMOTE_DEBUG) || (p_flags & EXPORT_DUMB_CLIENT);
const bool use_reverse = devices[p_device].api_level >= 21;
if (use_reverse)
p_flags |= EXPORT_REMOTE_DEBUG_LOCALHOST;
String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk"; String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk";
Error err = export_project(export_to, true, p_flags); Error err = export_project(export_to, true, p_flags);
@@ -1645,6 +1649,13 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
return ERR_CANT_CREATE; return ERR_CANT_CREATE;
} }
if (use_remote) {
if (use_reverse) {
static const char *const msg = "** Device API >= 21; debugging over USB **";
EditorNode::get_singleton()->get_log()->add_message(msg);
print_line(String(msg).to_upper());
args.clear(); args.clear();
args.push_back("-s"); args.push_back("-s");
args.push_back(devices[p_device].id); args.push_back(devices[p_device].id);
@@ -1680,6 +1691,13 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
print_line("Reverse result2: " + itos(rv)); print_line("Reverse result2: " + itos(rv));
} }
} else {
static const char *const msg = "** Device API < 21; debugging over Wi-Fi **";
EditorNode::get_singleton()->get_log()->add_message(msg);
print_line(String(msg).to_upper());
}
}
ep.step("Running on Device..", 3); ep.step("Running on Device..", 3);
args.clear(); args.clear();