2015-04-22 20 views
0

我想在android中構建一個CoAP服務器,並且我使用了cal的例子。Android的使用Californium的CoAP示例

https://github.com/curioustechizen/Californium/tree/4ace5b85974a0646aaaa6ab43c9314d1c5a438e1

但我在包Http.java遇到錯誤ch.ethz.inf.vs.californium.layers

它顯示

The type org.apache.http.entity.ContentType cannot be resolved. It is indirectly referenced from required .class files 

我想這個問題是在錯誤的.jar文件 我導入的庫像這樣:

apache-mimne4j.core-0.7.2.jar californium-0.18.7-final.jar commons-codec-1.6.jar commons-io-2.4.jar commons-logging-1.1.1.jar google-http- client-1.10.3-beta.jar google-oauth-client-1.10.1-beta.jar gson-2.1.jar guava-11.0.1.jar httpclient-4.2.1.jar httpclient-4.3.2.jar的HttpCore-NIO-4.2.1.jar jsr305-1.3.9.jar 的junit-3.8.1.jar的junit-4.8.1.jar的Mockito核-1.8.5.jar


希望任何人都可以告訴我最新的問題或如何解決問題,也可以詢問一些關於CoAP的android示例的開源代碼。

+0

你可以試試nCoap。參考請看看https://github.com/okleine/spitfirefox。 –

回答

0

我認爲你在那裏缺少一個http-components jar。 你使用maven嗎?

請注意:您的叉子太舊(2年)。 你可以在https://eclipse.org/californium/ 找到實際的Californium版本。它沒有android支持,但是我看到你的fork只刪除了很多文件,並且最多添加了一個android manifest - 所以它也可以完成。

+0

我沒有使用maven導致仍在學習Java,我去檢查所需的庫並從谷歌下載它。 –