React-native-contacts: Error on Build - package androidx.anottation

Created on 26 Jun 2019  路  4Comments  路  Source: morenoh149/react-native-contacts

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:
https://github.com/rt2zz/react-native-contacts/issues/395

Thanks for helping.

Most helpful comment

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!

All 4 comments

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

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.

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

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grit96 picture grit96  路  6Comments

narenderv7 picture narenderv7  路  5Comments

dubbelnisse picture dubbelnisse  路  10Comments

farrukhhashmi65 picture farrukhhashmi65  路  7Comments

DavidASix picture DavidASix  路  7Comments