react-native-admob icon indicating copy to clipboard operation
react-native-admob copied to clipboard

Build fails with latest React Native

Open SergiOnGit opened this issue 7 years ago • 20 comments

D:\projects\fortuna\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobRewardedVideoAdModule.java:89: error: method does not override or implement a method from a supertype @Override ^ 1 error :react-native-admob:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-admob:compileReleaseJavaWithJavac'.

How can i fix this?

SergiOnGit avatar Apr 30 '18 15:04 SergiOnGit

same issue with 2.0.0-beta.5

shockk avatar May 04 '18 10:05 shockk

Same thing. Anybody knows how to fix it?

endel avatar May 06 '18 03:05 endel

I am struggling with this one too. Working on Mac Sierra and failed to run on android emulator :(

khuongdv avatar May 06 '18 16:05 khuongdv

I think it's time when plugin author appears :))

SergiOnGit avatar May 06 '18 16:05 SergiOnGit

Hi all, I just delete the @Override annotation in the line 89 of the file RNAdMobRewardedVideoAdModule.java. And now it works :)

khuongdv avatar May 06 '18 16:05 khuongdv

Thanks, @khuongdv, this solved the compilation error. The next issue I'm having now is this one: https://github.com/sbugert/react-native-admob/issues/231, using [email protected].

Have you experienced this as well? Which version of react-native are you using?

endel avatar May 06 '18 19:05 endel

@khuongdv would you mind making a PR with your solution?

koenpunt avatar May 06 '18 22:05 koenpunt

I think this has to do with not using the latest version of the Google Mobile Ads SDK. Could you try to update the com.google.android.gms:play-services-ads dependency?

koenpunt avatar May 18 '18 06:05 koenpunt

removing the @Override works for me. I created a PR with the change.

respectTheCode avatar May 22 '18 10:05 respectTheCode

I was having error

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

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-admob:compileDebugJavaWithJavac'.

Solved by adding

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

iamadityaaz avatar Mar 06 '20 12:03 iamadityaaz

having the same problem :( unable to find the @override on line 89 in file RNAdMobRewardedVideoAdModule.java

eramudeep avatar Mar 16 '20 16:03 eramudeep

Hi all, I just delete the @override annotation in the line 89 of the file RNAdMobRewardedVideoAdModule.java. And now it works :)

unable to find annotation on line 89 :(

eramudeep avatar Mar 16 '20 16:03 eramudeep

Hi all, I just delete the @override annotation in the line 89 of the file RNAdMobRewardedVideoAdModule.java. And now it works :)

unable to find annotation on line 89 :(

You will need to add it manually

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

iamadityaaz avatar Mar 16 '20 16:03 iamadityaaz

getting this error then What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

eramudeep avatar Mar 16 '20 16:03 eramudeep

this helped me https://stackoverflow.com/a/50557355/9302583 Resolved

But it broke the entire proj. app is crashing on load

eramudeep avatar Mar 16 '20 16:03 eramudeep

replace plugin build.gradle file with this code

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation 'com.google.android.gms:play-services-ads:16.0.0'
}

SergiOnGit avatar Mar 16 '20 17:03 SergiOnGit

am using this version "react-native-admob": "^1.3.2", i was getting the same problem...

but after adding this - in ReactNative\test\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobRewardedVideoAdModule.java

after this :-

@Override
    public void onRewardedVideoAdLeftApplication() {
        sendEvent("rewardedVideoWillLeaveApplication", null);
    }

add this:-

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

viveKing21 avatar Jul 02 '20 07:07 viveKing21

Not an answer but an easy work around while finding a fix just set android.enableJetifier=false in the gradle.property

braysonjohn148 avatar Jul 12 '20 22:07 braysonjohn148

replace plugin build.gradle file with this code

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation 'com.google.android.gms:play-services-ads:16.0.0'
}

Not replaced exactly but updated the version as same to one in my project's build.gradle for this com.google.android.gms:play-services-ads. Thanks though! @SergiOnGit

rohit231095 avatar Apr 06 '21 14:04 rohit231095

Hi all, I just delete the @override annotation in the line 89 of the file RNAdMobRewardedVideoAdModule.java. And now it works :)

what is there in line no 89, can you please provide the code of that line?

pritamb1 avatar Apr 20 '21 14:04 pritamb1