Java Question Creating library in B4A with adding additional java library

bsnqt

Active Member
Licensed User
Longtime User
Hi Erel,

I am creating a library for B4A and used to do it successfully;
This time, I need to add an additional java library from here: http://code.google.com/p/libphonenumber/
I did import their .jar file to my project and compiled without error.

B4X:
import com.google.i18n.phonenumbers.*;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;

Finally, from Eclipse I can successfully export my .jar and .xml files
However, when I ran my B4A project, it says the following error:

java.lang.NoClassDefFoundError: com.google.i18n.phonenumbers.PhoneNumberUtil

I did something wrong?

Thank you
 

barx

Well-Known Member
Licensed User
Longtime User
Did you add the @DependsOn to your lib?

AND

Did you copy the 3rd party jar file to your b4a additional library folder?
 

bsnqt

Active Member
Licensed User
Longtime User
Did you add the @DependsOn to your lib?

AND

Did you copy the 3rd party jar file to your b4a additional library folder?


Hi Barx,

Your question #1: I did added it using the same way like adding B4AShared.jar, android.jar and Core.jar... is it correct?

Question #2: No, I did not yet, let me try it out right now... Thanks so much.
 

bsnqt

Active Member
Licensed User
Longtime User
Hi Barx,

I did copy the third party lib to the additional B4A library folder (and refresh the libs in the project) but it again does not work.

So I guessed I still doing wrongly with your Question 1. Please advise how can I add it as you said @DependsOn

EDIT: Ok, I figured out how to do it, just to add DependOn into xml file of my library...after searching in the forum.

THANK YOU VERY MUCH BARX, IT WORKS :)
 
Last edited:

Javier Alonso

Member
Licensed User
Longtime User
Hi, bsnqt

Could you please upload libphonenumber library for B4A? I've been trying but I haven't been able to compile it.

Thanks in advance
Javi
 

leitor79

Active Member
Licensed User
Longtime User
Hi bsnqt,

I'm using the same libraries as you (and some of your code, ehem), and I'm getting an error when I call the Validate(String phoneNumber, String defaultCountry) function.

java.lang.IllegalStateException: missing metadata: /com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UY

Did you get that error too? How do you solved it?

Thank you very much!
 
Top