java.lang.ClassNotFoundException for package com.t

2019-07-17 02:28发布

This is in continuation to my previous question: Getting compile error: package com.twilio.sdk does not exist

I got to resolve the complie error and now trying to run the uiautomator test on an android device. However, I am getting java.lang.ClassNotFoundException as the android device would not have Twilio API jars/classes.

So, I searched for solutions where I could build my final jar with Twilio API jar or the classes within that. I came across 'jar-jar' and 'one-jar' approaches to do so but did not work. I may be doing something wrong here. I'd really appreciate if someone could give a sample how to use any of these approaches.

I also found couple of other suggestions to do it via 'build.xml' such as adding the following line to the '-jar' task:

<zipgroupfileset dir="${jar.libs.dir}" includes="*.jar"/>

The above approached did include the Twilio classes to my final jar (my final jar size got increased by the size of the Twilio jar), however, my final jar could not persist the directory strucure for the Twilio classes within it. My final jar had all the classes at the root directory and all the folders were blank.

So, I am not aware of any more approaches to resolve this. If anyone of you have any suggestions/idea, please share.

Regards,

Rumit

2条回答
2楼-- · 2019-07-17 03:05

You are trying to crate a uber jar containing the class files in all the dependency jars. Use ZipFileSet ant element. Please see uber jar using ant for example.

查看更多
狗以群分
3楼-- · 2019-07-17 03:23

Following jar files are required to run twilio properly

  1. commons-httpclient-3.1.jar
  2. commons-logging.jar
  3. gwt-twilio-1.1.jar
  4. twilio-java-sdk-3.3.14.jar
  5. org.apache.httpcomponents.httpclient_4.3.1.jar

You have not provided the full stacktrace.I have done few projects in twilio and I use the above jar files otherwise classnotfound error occurs

查看更多
登录 后发表回答