Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find symbol @NonNull Task, v1.2.0 #30

Open
xempie opened this issue Oct 4, 2019 · 2 comments
Open

Error: Cannot find symbol @NonNull Task, v1.2.0 #30

xempie opened this issue Oct 4, 2019 · 2 comments

Comments

@xempie
Copy link

xempie commented Oct 4, 2019

I recently updated react native and RN android location enabler but I get this error when I run the project:

=========================================

Task :react-native-android-location-enabler:compileDebugJavaWithJavac FAILED
...\node_modules\react-native-android-location-enabler\android\src\main\java\com\heanoria\library\reactnative\locationenabler\RNAndroidLocationEnablerModule.java:8: error: package androidx.annotation does not exist
import androidx.annotation.NonNull;
^
...\node_modules\react-native-android-location-enabler\android\src\main\java\com\heanoria\library\reactnative\locationenabler\RNAndroidLocationEnablerModule.java:98: error: cannot find symbol
public void onComplete(@nonnull Task task) {
^
symbol: class NonNull
location: class RNAndroidLocationEnablerModule
2 errors

FAILURE: Build failed with an exception.

"react": "^16.10.1",
"react-native": "0.57.8",
"react-native-android-location-enabler": "^1.2.0",

Anyone knows how to fix it?

@je-martinez
Copy link

je-martinez commented Jun 20, 2020

This works for me:

Add the following two flags to true in your gradle.properties file at ProjectFolder/android/gradle.properties

android.useAndroidX=true
android.enableJetifier=true

Execute

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

In your package.json add the following to scripts
"postinstall" : "npx jetify"

Extra: At ProjectFolder/android delete .idea folder in case that cache it's causing a trouble.

Original Solution Source:
At Pavan Garre response:
https://stackoverflow.com/questions/40380519/error-package-com-android-annotations-does-not-exist

@Richou
Copy link
Owner

Richou commented Aug 20, 2020

For versions ReactNative < 0.60.0, please use [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants