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

error: package android.support.annotation does not exist

Open lydongray opened this issue 5 years ago • 6 comments

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?

lydongray avatar May 17 '20 05:05 lydongray

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

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

efstathiosntonas avatar May 28 '20 10:05 efstathiosntonas

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

tlgync avatar Aug 01 '20 01:08 tlgync

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

Thank you. This solved my issue.

HerbertLim avatar Aug 15 '20 07:08 HerbertLim

@tlgync Good solution

Mussabaheen avatar Nov 14 '20 16:11 Mussabaheen

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

had the same issue after upgrading to 0.64 with react-native-tcp and react-native-udp did they removed jetifier from react native cli?

ravi0the0sun avatar Jun 15 '21 08:06 ravi0the0sun