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 on Build - package androidx.anottation #400

Closed
rafaumlemos opened this issue Jun 26, 2019 · 4 comments
Closed

Error on Build - package androidx.anottation #400

rafaumlemos opened this issue Jun 26, 2019 · 4 comments

Comments

@rafaumlemos
Copy link

Hi guys.
I follow the installation guide and i'm with this error on build:

https://imgur.com/a/nOphw4M

I was checking some issues and i found that's similar with this one:
#395

Thanks for helping.

@rafaumlemos
Copy link
Author

If i change all androidx imports to not androidx, like:

// import androidx.annotation.NonNull;
// import androidx.core.app.ActivityCompat;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;

The error changes to:

https://imgur.com/a/u8fzkuB

@rafaumlemos
Copy link
Author

I solved it.

I change all androidx import, as i said here:

If i change all androidx imports to not androidx, like:

// import androidx.annotation.NonNull;
// import androidx.core.app.ActivityCompat;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;

The error changes to:

https://imgur.com/a/u8fzkuB

Then i run: react-native link

Thats it.

@morenoh149
Copy link
Owner

in the future please share errors as text so others can find via search

@mikehardy
Copy link
Contributor

Hi there! The whole react-native community will be struggling with the AndroidX transition for a while.

The community came up with a tool called jetifier that offers forwards compatibility from non-AndroidX apps to libraries (like this one) that have implemented AndroidX, by "reverse-jetifying" the source with a call to npx jetify -r so you can use the AndroidX version of the library in your non-AndroidX app, until you migrate.

I've tested it on this module and it appears to work (I use react-native-contacts in my app, I'm not just the jetifier maintainer).

I encourage you to migrate to AndroidX, but until then this can help.

When you do migrate to AndroidX you have the opposite problem with other libraries at which point you'd use jetifier in the forward direction with a call to npx jetify.

Please help spread the word so your fellow developers don't get stuck - app development is hard enough. Cheers!

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