Sin*_*imi 0 dependencies android module
我创建了一个具有类依赖关系的android模块,如下所示:
implementation 'com.squareup.moshi:moshi:1.5.0'
implementation 'com.neovisionaries:nv-websocket-client:2.3'
Run Code Online (Sandbox Code Playgroud)
我将此模块添加到我的项目中.当我想使用它时,它说"无法访问com.neovisionaries.Adapter".
1 - 为什么它无法访问因为我认为我的Async类在后台调用该方法?
2 - 我应该将该依赖项添加到我的项目中吗?
我的模块课程
public class Async extends WebSocketAdapter {
....
public Async() {
}
public static Async getInstance(Context context) {
if (instance == null) {
sharedPrefs = context.getSharedPreferences(AsyncConstant.Constants.PREFERENCE, Context.MODE_PRIVATE);
moshi = new Moshi.Builder().build();
instance = new Async();
}
return instance;
}
public void webSocketConnect(String socketServerAddress, final String appId) {
WebSocketFactory webSocketFactory = new WebSocketFactory();
webSocketFactory.setVerifyHostname(false);
setAppId(appId);
setServerAddress(socketServerAddress);
try {
webSocket = webSocketFactory
.setConnectionTimeout(TIMEOUT)
.createSocket(socketServerAddress)
.addListener(this);
webSocket.connectAsynchronously();
} catch (IOException e) {
e.printStackTrace();
}
}}
Run Code Online (Sandbox Code Playgroud)
MyPresenter类
public class SocketPresenter implements SocketContract.presenter {
private Async async;
private SocketContract.view view;
@Override
public void connect(String socketServerAddress, String appId) {
async.webSocketConnect(socketServerAddress, appId);
}
Run Code Online (Sandbox Code Playgroud)
此行有一个错误async.webSocketConnect(socketServerAddress, appId);,表示websocketConnect无法访问我的neseted模块依赖.
| 归档时间: |
|
| 查看次数: |
469 次 |
| 最近记录: |