React-native-admob: error: package android.support.annotation does not exist

Created on 17 May 2020  路  4Comments  路  Source: sbugert/react-native-admob

Hi,
I've seen this or similar errors in previous reported issues however they are all closed as the problem was resolved. I've tried all the solutions in the previous issues with no success.

This issue appears as soon as I add the react-native-admob package and run my app. I am using Android Studio 3.6.3, react-native 0.62.2 and react-native-admob 2.0.0-beta.6 (I get the same issue with react-native-admob 1.3.2 as well).

To replicate, I do the following:

> npx react-native init testrnadmob
> cd testrnadmob
> npm install --save [email protected]
open the project in Android Studio
> npm start
run the project in Android Studio on emulator

errors in the Build Output

D:\Projects\testrnadmob\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobBannerViewManager.java:4: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Projects\testrnadmob\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobInterstitialAdModule.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Projects\testrnadmob\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobRewardedVideoAdModule.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Projects\testrnadmob\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNPublisherBannerViewManager.java:4: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^

Has anybody else had this issue and found a solution?

Most helpful comment

npm install --save-dev jetifier
npx jetify
npx react-native run-android

All 4 comments

Having this issue too, can't fix, same stack

edit: possible fix https://github.com/sbugert/react-native-admob/issues/448#issuecomment-537659889

npm install --save-dev jetifier
npx jetify
npx react-native run-android

npm install --save-dev jetifier
npx jetify
npx react-native run-android

Thank you. This solved my issue.

@tlgync Good solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kanekotic picture kanekotic  路  6Comments

vu-dang picture vu-dang  路  5Comments

MohsinTariq10 picture MohsinTariq10  路  6Comments

xencodes picture xencodes  路  4Comments

mattveraldi picture mattveraldi  路  5Comments