Skip to content

Commit 24d6e3a

Browse files
authored
fix: better errors when android install fails (#427)
* fix: better errors when android install fails * changeset * improve adb install error message
1 parent dc200cd commit 24d6e3a

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.changeset/olive-socks-invent.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@rnef/platform-apple-helpers': patch
3+
'@rnef/platform-android': patch
4+
---
5+
6+
fix: better errors when android install fails

packages/platform-android/src/lib/commands/runAndroid/tryInstallAppOnDevice.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export async function tryInstallAppOnDevice(
6565
`Installed the app on ${device.readableName} (id: ${deviceId}).`
6666
);
6767
} catch (error) {
68-
const errorMessage = (error as SubprocessError).stdout;
68+
const errorMessage =
69+
(error as SubprocessError).stderr || (error as SubprocessError).stdout;
6970
if (errorMessage.includes('INSTALL_FAILED_INSUFFICIENT_STORAGE')) {
7071
try {
7172
loader.message('Trying to install again due to insufficient storage');
@@ -81,14 +82,18 @@ export async function tryInstallAppOnDevice(
8182
`Failed: Uninstalling and installing the app on ${device.readableName} (id: ${deviceId})`,
8283
1
8384
);
84-
const errorMessage = (error as SubprocessError).stdout;
85-
throw new RnefError(errorMessage);
85+
const errorMessage =
86+
(error as SubprocessError).stderr ||
87+
(error as SubprocessError).stdout;
88+
throw new RnefError(
89+
`The "adb" command failed with: ${errorMessage}. \nPlease uninstall the app manually and try again.`
90+
);
8691
}
8792
}
8893
loader.stop(
8994
`Failed: Installing the app on ${device.readableName} (id: ${deviceId})`,
9095
1
9196
);
92-
throw new RnefError(errorMessage);
97+
throw new RnefError(`The "adb" command failed with: ${errorMessage}.`);
9398
}
9499
}

packages/platform-apple-helpers/src/lib/utils/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function runCodegen(options: CodegenOptions) {
3535
]);
3636
} catch (error) {
3737
throw new RnefError('Failed to run React Native codegen script', {
38-
cause: (error as SubprocessError).stdout,
38+
cause: (error as SubprocessError).output,
3939
});
4040
}
4141
}

0 commit comments

Comments
 (0)