7
votes

Deps:

"native-base": "2.3.5",
"react": "16.0.0",
"react-native": "0.50.4",
"react-native-admob": "^2.0.0-beta.3",

After an update from RN 0.45 to 0.50 and RN-Admob from 1.3.2 to 2.0.0-beta.3

When trying to build with react-native run-android

/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobInterstitialAdModule.java:117:

error: cannot find symbol ArrayList list = nativeArray.toArrayList();

                                        ^   symbol:   method toArrayList()   location: variable nativeArray of type

ReadableNativeArray /Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java:129:

error: cannot find symbol ArrayList list = nativeArray.toArrayList();

                                      ^   symbol:   method toArrayList()   location: variable nativeArray of type

ReadableNativeArray /Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNPublisherBannerViewManager.java:252:

error: cannot find symbol ArrayList list = nativeArray.toArrayList();

                                        ^   symbol:   method toArrayList()   location: variable nativeArray of type

ReadableNativeArray /Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNPublisherBannerViewManager.java:271:

error: cannot find symbol ArrayList list = nativeArray.toArrayList();

                                        ^   symbol:   method toArrayList()   location: variable nativeArray of type

ReadableNativeArray /Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobBannerViewManager.java:223:

error: cannot find symbol ArrayList list = nativeArray.toArrayList();

                                        ^   symbol:   method toArrayList()   location: variable nativeArray of type

ReadableNativeArray 5 errors :react-native-admob:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-admob:compileReleaseJavaWithJavac'. Compilation failed; see the compiler error output for details.

I tried also RN 0.51 and manual unlink and re-link but nothing worked.

4
When using react-native and upgrading packages a lot of times things go broke! Have you tried rm -rf your entire app and reinstalling, then installing, then re linking. This issue sounds like a linking issue, react-native link didn't always work as intended for myself. Ultimately I downgraded to xcode 9 with a manual install then rebuilt through xcode (I don't know xcode well, its easy). This all happened for me when I installed High Sierra and upgraded Xcode. (Hopefully this helps even though you're using android) - Gavin Thomas
IOS works fine for us ... We have a problem with android - Lukáš Šálek

4 Answers

0
votes

I think your android project still have the old linking. You should open your project in android studio and check your main activity class

0
votes

Try to check your MainActivity first, and even if error occurs. Then i think you have to downgrade your react-native-admob version form v2.0.0 to v1.3.2. It will work definitely.

Because, there is some issue in v2.0.0 which is still beta. You can check more about this issue on github here, https://github.com/sbugert/react-native-admob/issues/231

0
votes

After days of investigations and unlinking and re-linking I solved it with:

  maven {

            url "$rootDir/../node_modules/react-native/android"

        }

in build.gradle file.

Old url was "$projectDir/../../node_modules/react-native/android"

So it was a gradle issue. When building it used to get old react-native android libs.

0
votes

Update the file :- Build.gradle(react-native-admob)

//implementation 'com.google.android.gms:play-services-ads:+' // Comment this line

implementation 'com.google.android.gms:play-services-ads:19.7.0' // Add this line