clipboard: Execution failed for task ':react-native-clipboard_clipboard:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.

Environment

Platforms

Versions

  • Android:
  • iOS:
  • react-native-netinfo:
  • react-native:
  • react:

Description

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 Note: /Users/extended/Downloads/vibesocialmusic-82830-react-native copy/src/node_modules/@invertase/react-native-apple-authentication/android/src/main/java/com/RNAppleAuthentication/AppleAuthenticationAndroidModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /Users/extended/Downloads/vibesocialmusic-82830-react-native copy/src/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. /Users/extended/Downloads/vibesocialmusic-82830-react-native copy/src/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:136: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){ ^ symbol: variable R location: class VERSION_CODES /Users/extended/Downloads/vibesocialmusic-82830-react-native copy/src/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:137: error: cannot find symbol bitmap.compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 100, outputStream); ^ symbol: variable WEBP_LOSSLESS location: class CompressFormat Note: /Users/extended/Downloads/vibesocialmusic-82830-react-native copy/src/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors

Reproducible Demo

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 12
  • Comments: 22 (3 by maintainers)

Most upvoted comments

you need to just remove this package and @react-native-community\clipboard and install this reinstall this react-native-clipboard/clipboard one

I followed below steps which solved my problem.

  1. go to this file. node_modules@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java
  2. import this : import com.facebook.react.bridge.ReactApplicationContext;
  3. convert extened package from ContextBaseJavaModule to ReactContextBaseJavaModule everywhere in file(maybe used at two places)
  4. conver this : from: public ClipboardModule(Context context) { super(context); } private ClipboardManager getClipboardService() { return (ClipboardManager) getcontext().getSystemService(getcontext().CLIPBOARD_SERVICE); } to: public ClipboardModule(Context context) { super(new ReactApplicationContext(context)); }

private ClipboardManager getClipboardService() { return (ClipboardManager) getReactApplicationContext().getSystemService(getReactApplicationContext().CLIPBOARD_SERVICE); }

this worked for me . Hope this will guide you thanks

you need to just remove this package and @react-native-community\clipboard and install this reinstall this react-native-clipboard/clipboard one

this worked for me.

Apologies to all who encountered this issue, please upgrade your compileSdkVersion to 30. The previous Bitmap.CompressFormat WEBP enum was deprecated in API level 30 hence WEBP_LOSSLESS enum was introduced. I’ll make a PR to update this requirement in the docs.

+1 Have same issue. It was introduced in v1.11.0 with support for WEBP. Version 1.10.0 works fine.

I also encountered this issue and after some investigation it was caused as I was forcing dependencies to run on Android API version 29 as I needed it at the time for StethoWrapper to work with my react native project for Chrome debugging. API version 29 does not have the enum WEBP_LOSSLESS in the graphics package ( I believe it was introduced in API 30) hence this error.

I use Flipper now so I just removed these lines from my android/build.gradle and removed StethoWrapper

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 29     // have to match with build.gradle and app/build.gradle ones
                buildToolsVersion '29.0.3'  // have to match with build.gradle and app/build.gradle ones
            }
        }
    }
}

you need to just remove this package and @react-native-community\clipboard and install this reinstall this react-native-clipboard/clipboard one

actually i’m using react-native-otp-model by using @twotalltotems/react-native-otp-input library. but i’m getting this error.Cannot read property ‘getString’ of null. have you resolved this error earlier?

+1 Same

I have tried uninstalling and Re-installing Try 1: npm install @twotalltotems/react-native-otp-input react-native-clipboard/clipboard Try 2: npm install --save @react-native-community/react-native-clipboard Try 3: Tried togeling minSdkVersion from 21 to 24 and vise versa.

i have also raised the same https://github.com/tttstudios/react-native-otp-input/issues/227