react-native-clipboard / clipboard

React Native Clipboard API for both iOS and Android.
MIT License
669 stars 118 forks source link

public class ClipboardModule extends NativeClipboardModuleSpec #238

Open andriiradkevych opened 2 months ago

andriiradkevych commented 2 months ago

After npx react-native run-android , I get :

/Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:39: error: ClipboardModule is not abstract and does not override abstract method removeListeners(double) in NativeClipboardModuleSpec
public class ClipboardModule extends NativeClipboardModuleSpec {
       ^
/Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:240: error: method does not override or implement a method from a supertype
  @Override
  ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardPackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

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

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 7s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:39: error: ClipboardModule is not abstract and does not override abstract method removeListeners(double) in NativeClipboardModuleSpec
public class ClipboardModule extends NativeClipboardModuleSpec { ^
/Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java:240: error: method does not override or implement a method from a supertype @Override ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/andreyradkevich/dev/native_cabinet/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardPackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-clipboard_clipboard:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details. * Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights. BUILD FAILED in 7s.

package.json

    "@react-native-clipboard/clipboard": "^1.14.1",
     "react-native": "^0.73.4",
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'

        ndkVersion = "25.1.8937393"
    }
Gu1K commented 2 months ago

same error

vlsido commented 2 months ago

It seems to me #237 broke build on android?

react-native 0.73.4, new arch enabled

Changing type in ClipboardModule.java fixed it for me

before:

  @Override
  public void removeListeners(int count) {

  }

after:

  @Override
  public void removeListeners(double count) {

  }
Qdafengzi commented 2 weeks ago

为何一直不更新库 ,每次编译都报错,需要手动更改