Rixwen
Rixwen

Reputation: 275

cannot resolve symbol PhoneNumberUtil

i try using libphonenumber from https://github.com/googlei18n/libphonenumber, i already add it in the dependency but it shows "cannot resolve symbol PhoneNumberUtil". Why is that? By the way, i'm using android studio

Upvotes: 7

Views: 4203

Answers (3)

ivan.panasiuk
ivan.panasiuk

Reputation: 1259

Here are instructions in 6 steps for Android Studio 3.1:

  1. open "File -> Project Structure" from the main menu
  2. select the "Dependencies" tab
  3. click on "+" on the right
  4. choose "1. Library dependencies" (or other if you know what you are doing)
  5. in search box enter desired library name "libphonenumber"
  6. choose desire lib and click "OK" and "OK"

That's it.

Upvotes: 6

Rixwen
Rixwen

Reputation: 275

Thanks everyone I've found my answer i manually add compile 'com.googlecode.libphonenumber:libphonenumber:7.0.4' in build.gradle

when i try to find it by searching in adding library, i can't find it

Upvotes: 13

Harish_N
Harish_N

Reputation: 2257

Downlaod the libphonenumber Jar from Here libphonenumber-3.0.0-javadoc.jar

Add the above obtained libphonenumber-3.0.0-javadoc.jar into libs folder of your project.

Now add dependency in your Apps gradle File by adding following line

compile files ('libs/libphonenumber-3.0.0-javadoc.jar' )

Apps gradle file should now look like below image

Now click on Sync project with Gradle Files.

enter image description here

Now you should be able to use PhoneNumberUtil class.

Upvotes: 1

Related Questions