如何从删除的android.jar一个包?android、jar

由网友(咒)分享简介:我正在使用该API semantics3一个Android应用程序。包括在semantics3库是org.json包这对功能关键。使用org.json类和函数的code被全部纳入API和从Android应用程序的工作独立。I'm working on an android application that uses...

我正在使用该API semantics3一个Android应用程序。包括在semantics3库是org.json包这对功能关键。使用org.json类和函数的code被全部纳入API和从Android应用程序的工作独立。

I'm working on an android application that uses the semantics3 api. Included in the semantics3 library is the org.json package which is crucial to the functionality. The code using org.json classes and functions is all included in the api and works standalone from the android application.

问题,据我所知,是的android.jar还包括一个名为org.json包,但它比semantics3 org.json功能较少。当试图调用应用程序内的semantics3 API,我得到以下错误:

The problem, as far as I can tell, is that android.jar also includes a package named org.json, but it has less functionality than the semantics3 org.json. When trying to call the semantics3 api within the app, I get the following error:

05-22 12:06:07.058: W/System.err(6108): java.lang.NoSuchMethodError: org.json.JSONTokener.<init>
05-22 12:06:07.058: W/System.err(6108):     at com.semantics3.api.Semantics3Request.fetch(Semantics3Request.java:70)
05-22 12:06:07.058: W/System.err(6108):     at com.semantics3.api.Semantics3Request.runQuery(Semantics3Request.java:143)
05-22 12:06:07.058: W/System.err(6108):     at com.semantics3.api.Semantics3Request.get(Semantics3Request.java:162)
05-22 12:06:07.058: W/System.err(6108):     at com.semantics3.api.Semantics3Request.get(Semantics3Request.java:154)
05-22 12:06:07.058: W/System.err(6108):     at com.semantics3.api.Products.getProducts(Products.java:21)
05-22 12:06:07.058: W/System.err(6108):     at com.cs194.windowshopping.ProductSearch.findKeywordSearchResults(ProductSearch.java:132)
05-22 12:06:07.058: W/System.err(6108):     at com.cs194.windowshopping.ProductSearch.queryByPicture(ProductSearch.java:66)
05-22 12:06:07.058: W/System.err(6108):     at com.cs194.windowshopping.ResultsActivity$PopulateResultList.doInBackground(ResultsActivity.java:116)
05-22 12:06:07.058: W/System.err(6108):     at com.cs194.windowshopping.ResultsActivity$PopulateResultList.doInBackground(ResultsActivity.java:1)
05-22 12:06:07.058: W/System.err(6108):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-22 12:06:07.068: W/System.err(6108):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
05-22 12:06:07.068: W/System.err(6108):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-22 12:06:07.068: W/System.err(6108):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-22 12:06:07.068: W/System.err(6108):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-22 12:06:07.068: W/System.err(6108):     at java.lang.Thread.run(Thread.java:841)

我想我的问题是我如何确保我的应用程序使用正确的org.json包?或如何从的android.jar删除org.json包,因此,只有一个在semantics3.jar存在?

I guess my question is how do I make sure that my application uses the right org.json package? Or how do I remove the org.json package from android.jar, so that only the one in semantics3.jar exists?

推荐答案

您可以派生于GitHub的项目: https://github.com/Semantics3/semantics3-java

You can fork the project at GitHub: https://github.com/Semantics3/semantics3-java

该软件是MIT许可,所以你可以重新打包 org.json在semantics3(如重命名为org.jsonplus),然后你不应该有在Android上的任何问题。凭借良好的Java IDE这个只需要一分钟左右。当然,你必须改变你的客户端code,以及使用新的软件包。

The software is MIT-licensed so you could repackage org.json in semantics3 (e.g. rename it to org.jsonplus) and then you shouldn't have any problems on Android. With a good Java IDE this only takes a minute or so. Of course you have to change your client code as well to use the new packages.

阅读全文

相关推荐

最新文章