40 | Package and install the product on a connected android device.
41 | Only executed when target-platform is set to Android
48 .OnlyWhenStatic(this.IsAndroidPlatform)
49 .DependsOn(SetupPlatformSdk)
54 var adb = this.GetAndroidSdk().GetAdb(
this);
55 var appName = this.GetAppName();
57 var apkFile = this.GetApkFile();
58 Assert.True(apkFile.FileExists());
64 Log.Information(
"Uninstall {0} (failures here are not fatal)", appName);
65 adb($
"uninstall {appName}");
69 Log.Warning(e,
"Uninstallation threw errors, but that might not be a problem");
73 Log.Information(
"Installing {0}", apkFile);
74 adb($
"install {apkFile}");
76 var storagePath = adb(
"shell echo $EXTERNAL_STORAGE")!
77 .FirstOrDefault(o => !
string.IsNullOrWhiteSpace(o.Text))
80 Assert.False(
string.IsNullOrWhiteSpace(storagePath),
"Couldn't get a storage path from the device");
86 Log.Information(
"Removing existing assets from device (failures here are not fatal)");
87 adb($
"shell rm -r {storagePath}/UE4Game/{ProjectName}");
88 adb($
"shell rm -r {storagePath}/UE4Game/UE4CommandLine.txt");
89 adb($
"shell rm -r {storagePath}/obb/{appName}");
90 adb($
"shell rm -r {storagePath}/Android/obb/{appName}");
91 adb($
"shell rm -r {storagePath}/Download/obb/{appName}");
95 Log.Warning(e,
"Removing existing asset files threw errors, but that might not be a problem");
99 var obbName = $
"main.1.{appName}";
100 var obbFile = apkFile.Parent / (obbName +
".obb");
102 if (obbFile.FileExists())
104 Log.Information(
"Installing {0}", obbFile);
106 adb($
"push {obbFile} {storagePath}/obb/{appName}/{obbName}.obb");
109 Log.Information(
"Grant READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE to the apk for reading OBB file or game file in external storage.");
111 adb($
"shell pm grant {appName} android.permission.READ_EXTERNAL_STORAGE");
112 adb($
"shell pm grant {appName} android.permission.WRITE_EXTERNAL_STORAGE");
114 Log.Information(
"Done installing {0}", appName);
130 | Launch the product on android but wait for debugger.
131 | This requires ADB to be in your PATH and NDK to be correctly configured.
132 | Only executed when target-platform is set to Android
137 .OnlyWhenStatic(this.IsAndroidPlatform)
138 .DependsOn(SetupPlatformSdk)
142 var adb = this.GetAndroidSdk().GetAdb(
this);
143 var appName = this.GetAppName();
145 Log.Information(
"Running {0} but wait for a debugger to be attached", appName);
146 adb($
"shell am start -D -n {appName}/com.epicgames.ue4.GameActivity");