我刚刚开始学习使用Android Studio的MQTT协议.使用mosquitto broker,我可以在pub / sub窗口之间交换消息.但是当我通过android studio向经纪人发送消息时,应用程序构建成功,但是在经纪人的终端上没有显示任何内容.系统打印连接失败.相同的代码在eclipse java应用程序上运行正常,但是虽然已经添加了必需的库和依赖项,但是不能在android上运行.
请帮助,我在这个基本步骤中缺少什么,这样我才能向前学习.谢谢!
APP-的build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
// have added following dependencies
provided 'com.google.android.things:androidthings:0.2-devpreview'
provided 'com.google.android.thing