【发布时间】:2017-04-19 03:52:02
【问题描述】:
我正在努力使用 AllJoyn 中的属性。我是 AllJoyn 的新手,但不是编程新手。我有一个编写 C++ 的提供程序,我使用
添加我的属性status = m_Description->AddProperty("ServerName", "s", 1)
之后呼叫状态等于 ER_OK。
我在接口中定义我的 Java 属性如下:
@BusProperty(annotation = BusProperty.ANNOTATE_EMIT_CHANGED_SIGNAL)
String getServerName() throws BusException;
但是,当我尝试在 Java 中使用该属性时(使用 Android Studio 的 Android),调用方式为:
String str = proxyInterface.getServerName();
我不断收到以下异常:
04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:org.alljoyn.bus.AnnotationBusException:字段公共 静态瞬态易失 com.android.tools.fd.runtime.IncrementalChange com.wolfecomputerservices.cumulus.ui.Android.Communication.AllJoyn.Objects.ServerData.$change 类的 com.wolfecomputerservices.cumulus.ui.Android.Communication.AllJoyn.Objects.ServerData 不注释位置 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 org.alljoyn.bus.Signature.structTypes(Signature.java:71) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.Signature.classTypeSig(Signature.java:170) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.Signature.typeSig(Signature.java:117) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.InterfaceDescription.getOutSig(InterfaceDescription.java:511) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.InterfaceDescription.addMembers(InterfaceDescription.java:386) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.InterfaceDescription.create(InterfaceDescription.java:199) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.ProxyBusObject.addInterface(ProxyBusObject.java:115) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 org.alljoyn.bus.ProxyBusObject.getProperty(Native 方法) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 org.alljoyn.bus.ProxyBusObject.access$400(ProxyBusObject.java:35) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 org.alljoyn.bus.ProxyBusObject$Handler.invoke(ProxyBusObject.java:274) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 java.lang.reflect.Proxy.invoke(Proxy.java:397) 04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 $Proxy4.getServerRunning(未知来源)04-07 10:11:45.592 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 com.wolfecomputerservices.cumulus.ui.Android.Communication.AllJoyn.Interfaces.ICumulusImpl.IsRunning(ICumulusImpl.java:24) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 com.wolfecomputerservices.cumulus.ui.Android.Communication.AllJoyn.Handlers.BusHandler.processMessage(BusHandler.java:276) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 com.wolfecomputerservices.cumulus.ui.Android.Abstracts.PauseHandler.handleMessage(PauseHandler.java:75) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 android.os.Handler.dispatchMessage(Handler.java:111) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 android.os.Looper.loop(Looper.java:194) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 android.app.ActivityThread.main(ActivityThread.java:5567) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 java.lang.reflect.Method.invoke(Native Method) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W/System.err:在 java.lang.reflect.Method.invoke(Method.java:372) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955) 04-07 10:11:45.593 26005-26005/com.wolfecomputerservices.cumulus W / System.err:在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
注意:我确实有一个返回值为 ServerData 的方法。 但是,发生此错误时,这不是我要调用的。我 在尝试调用该方法之前很久就成功地进行了该调用。它 是导致此异常的方法调用。不过,我确实有 使用 @Position(x) 注释的 ServerData 为每个字段编号 0-4。
我做错了什么?
更新:
来自 C++ 提供程序的服务器数据
class ServerData {
public:
const char* Id;
const char* Name;
const char* Version;
const char* MachineName;
const char* BaseUrl;
};
来自 Java 消费者:
public class ServerData {
@Position(0)
@Signature("s")
public String Id;
@Position(1)
@Signature("s")
public String Name;
@Position(2)
@Signature("s")
public String Version;
@Position(3)
@Signature("s")
public String MachineName;
@Position(4)
@Signature("s")
public String BaseURL;
}
更新:不幸的是,我似乎无法切换 gradle 版本。我目前在 2.3.1;在构建过程中切换到 2.1.3 会导致以下错误(我已经尝试了列出的所有建议):
不幸的是,我似乎无法切换 gradle 版本。我目前在 2.3.1;在构建过程中切换到 2.1.3 会导致以下错误: 错误:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection 无法转换为 org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection 此意外错误的可能原因包括:
- Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。) 重新下载依赖并同步项目(需要网络)
- Gradle 构建过程(守护程序)的状态可能已损坏。停止所有 Gradle 守护程序可能会解决此问题。 停止 Gradle 构建过程(需要重新启动)
- 您的项目可能正在使用与项目中的其他插件或项目请求的 Gradle 版本不兼容的第三方插件。
【问题讨论】:
标签: java android alljoyn android-studio-2.3