summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/android/export/export.cpp74
1 files changed, 46 insertions, 28 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 16169c88c2..ef348d8685 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1073,7 +1073,11 @@ public:
//export_temp
ep.step("Exporting APK", 0);
- p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
+ const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
+ const bool use_reverse = devices[p_device].api_level >= 21;
+
+ if (use_reverse)
+ p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk";
Error err = export_project(p_preset, true, export_to, p_debug_flags);
@@ -1119,40 +1123,54 @@ public:
return ERR_CANT_CREATE;
}
- if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
+ if (use_remote) {
+ if (use_reverse) {
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("--remove-all");
- OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ 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());
- int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("tcp:" + itos(dbg_port));
- args.push_back("tcp:" + itos(dbg_port));
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("--remove-all");
+ OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- print_line("Reverse result: " + itos(rv));
- }
+ if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) {
+ int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("tcp:" + itos(dbg_port));
+ args.push_back("tcp:" + itos(dbg_port));
- int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
+ OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ print_line("Reverse result: " + itos(rv));
+ }
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("tcp:" + itos(fs_port));
- args.push_back("tcp:" + itos(fs_port));
+ if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) {
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- print_line("Reverse result2: " + itos(rv));
+ int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
+
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("tcp:" + itos(fs_port));
+ args.push_back("tcp:" + itos(fs_port));
+
+ err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &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);