react-native-screen-brightness icon indicating copy to clipboard operation
react-native-screen-brightness copied to clipboard

【Solve】Build failed with an exception

Open yuansyuntw opened this issue 7 years ago • 2 comments

Hello, I follow it .

LINK

But I can not build it successfully.

:react-native-screen-brightness:compileReleaseJavaWithJavac
D:\Racti Native\Anping_V002\node_modules\react-native-screen-brightness\android\src\main\java\com\robinpowered\react\ScreenBrightness\ScreenBrightnessModule.java:28: error: ScreenBrightnessModule is not abstract and does not override abstract method onNewIntent(Intent) in ActivityEventListener
public class ScreenBrightnessModule extends ReactContextBaseJavaModule
       ^
D:\Racti Native\Anping_V002\node_modules\react-native-screen-brightness\android\src\main\java\com\robinpowered\react\ScreenBrightness\ScreenBrightnessModule.java:64: error: method does not override or implement a method from a supertype
    @Override
    ^
2 errors
:react-native-screen-brightness:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

How can I modify it? Thanks

yuansyuntw avatar Mar 01 '17 04:03 yuansyuntw

I solved it.

The Cause:

I react-native is "0.39.2". OS: windows 10 Mobile platform: Android 6.0

RN 0.33 Modify

ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java
 @@ -2,17 +2,19 @@
  
  package com.facebook.react.bridge;
  
 +import android.app.Activity;
  import android.content.Intent;
  
  /**
 - * Listener for receiving activity events.
 + * Listener for receiving activity events. Consider using {@link BaseActivityEventListener} if
 + * you're not interested in all the events sent to this interface.
   */
  public interface ActivityEventListener {
  
    /**
     * Called when host (activity/service) receives an {@link Activity#onActivityResult} call.
     */
 -  void onActivityResult(int requestCode, int resultCode, Intent data);
 +  void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data);
  
    /**
     * Called when a new intent is passed to the activity
    */
   void onNewIntent(Intent intent);
 }

The solution:

Modify File

node_modules\react-native-screen-brightness\android\src\main\java\com\robinpowered\react\ScreenBrightness\ScreenBrightnessModule.java

open picture

yuansyuntw avatar Mar 01 '17 06:03 yuansyuntw

Hello, I have almost the same issue, my build failed with this errir : Task :react-native-screen-brightness:javaPreCompileDebug FAILED, I can't see what do I have to change on node_modules\react-native-screen-brightness\android\src\main\java\com\robinpowered\react\ScreenBrightness\ScreenBrightnessModule.java, could you tell me please?

Pazokita avatar Jan 19 '23 16:01 Pazokita