Details
Description
After someone introduced any changes in the source code, there are a lot of steps before these changes will be reflected on an Android device, and performing all these steps is very time consuming. The steps are collected in 4 groups:
1) rebuild the C++ binary
2) recreate APK
3) deploy APK
4) launch full-scope debug session
But for the overwhelming majority of the cases there is no need to perform all these steps. Since changes affect only single C++ binary, steps 2 and 3 can be completely dropped. Instead, we should strip the binary and push it directly to its ultimate destination place on the Android device. It can be done at least on old Android releases and (perhaps, I didn't try it) on rooted devices. The step 4 can be shortened, if we allow loading debug symbols only for the single binary. The proposed remedies allow to decrease time waste dramatically.
Alongside with the regular "Start Debugging" button (option), Qt Creator should introduce "Quick Start Debugging" button. I made such option being triggered by "Start Debugging" while "Ctrl" keyboard button is pressed. Corresponding changes in the source code may look like the following:
In GdbEngine::setupInferior() :
if(QuickLaunch())
{
QString solibSearchPath = rp.projectSourceDirectory+"/bin";
runCommand({"auto-solib-add off"});
runCommand({"set solib-search-path " + solibSearchPath});
// allow loading debug symbols only for the single binary
}
else
{
if (!rp.solibSearchPath.isEmpty()) {
DebuggerCommand cmd("appendSolibSearchPath");
cmd.arg("path", rp.solibSearchPath);
cmd.arg("separator", HostOsInfo::pathListSeparator());
runCommand(cmd);
}
void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
Core::Id runMode,
const bool forceSkipDeploy)
{
if (!rc->isEnabled())
return;
bool android, quick_launch;
quick_launch=QuickLaunch();
android=(rc->abi().osFlavor()==Abi::AndroidLinuxFlavor);
QList<Id> stepIds;
if (!quick_launch&&
!forceSkipDeploy && dd->m_projectExplorerSettings.deployBeforeRun) {
if (dd->m_projectExplorerSettings.buildBeforeDeploy)
stepIds << Id(Constants::BUILDSTEPS_BUILD);
stepIds << Id(Constants::BUILDSTEPS_DEPLOY);
}
Project *pro = rc->target()->project();
int queueCount = dd->queue(SessionManager::projectOrder(pro), stepIds);
if (queueCount < 0) // something went wrong
return;
if(android)
{
QString profile_path=ProFilePathFromRunConfiguration(rc);
if(quick_launch)
AndroidQuickUpload(profile_path);// recompile, strip and push binary to its destination
}
........................so forth with runRunConfiguration()
Attachments
Issue Links
- relates to
-
QTBUG-86674 Deploying Qt application to Android device is really slow
-
- Closed
-