React-native-admob: Task :react-native-admob:compileReleaseJavaWithJavac FAILED

Created on 13 Sep 2019  路  5Comments  路  Source: sbugert/react-native-admob

image

I've tried changing these

compileSdkVersion 27
buildToolsVersion "27.0.3"

I've installed the module using npm i -S react-native-admob@next

Most helpful comment

If you are using androidx than try going to node_modules/react-native-admob , find the files from where you are getting the error and replace import android.support.annotation.Nullable; with import androidx.annotation.Nullable;

I hope this helps.

All 5 comments

If you are using androidx than try going to node_modules/react-native-admob , find the files from where you are getting the error and replace import android.support.annotation.Nullable; with import androidx.annotation.Nullable;

I hope this helps.

If you are using androidx than try going to node_modules/react-native-admob , find the files from where you are getting the error and replace import android.support.annotation.Nullable; with import androidx.annotation.Nullable;

I hope this helps.

If you get Override error you may want to comment these lines on

    @Override
     public void onRewardedVideoCompleted() {
         sendEvent(EVENT_VIDEO_COMPLETED, null);
     }

on this file /node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java

@Override 
     public  void onRewardsVideoCompleted () { 
         sendEvent ( EVENT_VIDEO_COMPLETED , null ); 
     }

in my case this method not added in class node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java

/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewarde
dVideoAdModule.java:20: error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVid
eoCompleted() in RewardedVideoAdListener
public class RNAdMobRewardedVideoAdModule extends ReactContextBaseJavaModule implements RewardedVideoAdListener {
^
1 error

FAILURE: Build failed with an exception.

+1

the solution a preetty worse workaround. it should solve in the codebase.

Was this page helpful?
0 / 5 - 0 ratings