7

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

Rixwen
  • 275
  • 3
  • 11
  • Have you added this library to build Path using configure build path? – Bhagwat K Apr 29 '15 at 05:34
  • Here is the solution that worked for me: Add library project dependency to the android studio. [1]: http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio – Bhagwat K Apr 29 '15 at 05:38

3 Answers3

13

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

Rixwen
  • 275
  • 3
  • 11
6

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.

ivan.panasiuk
  • 1,239
  • 16
  • 20
1

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.

Harish_N
  • 2,249
  • 3
  • 23
  • 34