react-native-audio-recorder-player icon indicating copy to clipboard operation
react-native-audio-recorder-player copied to clipboard

Unable to successfully build on android with expo eas build

Open skjorrface opened this issue 2 years ago • 4 comments

Version of react-native-audio-recorder-player

3.3.4

Version of React Native

0.70.4

Platforms you faced the error (IOS or Android or both?)

Android only

Expected behavior

App should correctly build android with expo sdk 46 and expo-dev-client, using eas build services.

Actual behavior

App build android fails with the following error: [stderr] * What went wrong: [stderr] A problem occurred configuring project ':react-native-audio-recorder-player'. [stderr] > compileSdkVersion is not specified. Please add it to build.gradle [stderr] * Try: [stderr] > Run with --stacktrace option to get the stack trace. [stderr] > Run with --info or --debug option to get more log output. [stderr] > Run with --scan to get full insights. [stderr] ============================================================================== [stderr] * Get more help at https://help.gradle.org [stderr] BUILD FAILED in 2m 35s

Steps to reproduce the behavior

Init expo app with sdk 46 and expo-dev-client and add this library as dependency, then try to build for android.

Any hint on how I could solve this?

skjorrface avatar Jan 21 '23 14:01 skjorrface

@hyochan I am also facing the same issue after upgrading from 0.70.8 to 0.71.7:

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/me/dev/rntester/app/node_modules/react-native-audio-recorder-player/android/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating project ':react-native-audio-recorder-player'.
> Plugin with id 'kotlin-android' not found.

Some other related issues:

  • https://github.com/hyochan/react-native-audio-recorder-player/issues/410

KrisLau avatar Apr 28 '23 16:04 KrisLau

Any resolution to this? How did you guys fix it?

frozencap avatar Aug 06 '23 15:08 frozencap

fixed it with this Expo mod plugin in Expo 49

const config = {
  name: 'my-app'
}

const withJetbrainsKotlinGradlePlugin: ConfigPlugin = (config, _) =>
  withProjectBuildGradle(config, config => {
    if (config.modResults.language !== 'groovy') throw new Error('Not groovy');

    const pattern = 'dependencies {';
    const replacement = `
      dependencies {
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"`;

    config.modResults.contents = config.modResults.contents.replace(
      pattern,
      replacement,
    );
    return config;
  });

export default withJetbrainsKotlinGradlePlugin(config);

however the lib is entirely unusable for me because output format configuration does not work. Always get mp4 on Android and m4a on iOS. Migrating to expo-av

frozencap avatar Aug 06 '23 20:08 frozencap

That's exactly what I've done, I switched to expo-av.

skjorrface avatar Aug 06 '23 20:08 skjorrface