Skip to content

Commit

Permalink
fix(cli): Better error on gradlew permission problems (#5405)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Feb 4, 2022
1 parent beebff4 commit 9420f08
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions cli/src/android/run.ts
Expand Up @@ -24,11 +24,22 @@ export async function runAndroid(

debug('Invoking ./gradlew with args: %O', gradleArgs);

await runTask('Running Gradle build', async () =>
runCommand('./gradlew', gradleArgs, {
cwd: config.android.platformDirAbs,
}),
);
try {
await runTask('Running Gradle build', async () =>
runCommand('./gradlew', gradleArgs, {
cwd: config.android.platformDirAbs,
}),
);
} catch (e) {
if (e.includes('EACCES')) {
throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${c.strong(
`chmod +x ./${config.android.platformDir}/gradlew`,
)} and try again.`;
} else {
throw e;
}
}

const apkPath = resolve(
config.android.buildOutputDirAbs,
config.android.apkName,
Expand Down

0 comments on commit 9420f08

Please sign in to comment.