我在nativescipt项目的运行时遇到错误:
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method onConnected failed
Error: java.lang.Exception: Failed resolving method subscribe on class com.google.android.gms.nearby.messages.internal.zzs
com.tns.Runtime.resolveMethodOverload(Runtime.java:983)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1022)
com.tns.Runtime.callJSMethodImpl(Runtime.java:907)
com.tns.Runtime.callJSMethod(Runtime.java:895)
com.tns.Runtime.callJSMethod(Runtime.java:879)
com.tns.Runtime.callJSMethod(Runtime.java:871)
执行以下代码:
var test = ...//GoogleApiClient
var SubscribeOptions = com.google.android.gms.nearby.messages.SubscribeOptions;
var Strategy = com.google.android.gms.nearby.messages.Strategy;
var MessageListener = com.google.android.gms.nearby.messages.MessageListener.extend({
onFound: function(message){
Log.d("MESSAGE", "Found message :) ");
},
onLost: function(message){
Log.d("MESSAGE", "Lost message :( ");
}
});
var mMessageListener = new MessageListener();
var options = new SubscribeOptions.Builder()
.setStrategy(Strategy.BLE_ONLY)
.build();
var mMessages = new com.google.android.gms.nearby.Nearby.Messages.subscribe(test, mMessageListener, options);
在构建过程中我得到了一些执行,他们可能是原因吗?如果是,如何解决?
Merged dex #50 (1 defs/1,3KiB)
Merged dex #51 (3445 defs/3916,6KiB)
Result is 3495 defs/4907,8KiB. Took 0,2s
:buildMetadata
Skip com.google.android.gms.internal.zzt
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzw
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzy
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzz
Error: java.lang.NullPointerException
'assets/metadata/treeNodeStream.dat' NOT FOUND
'assets/metadata/treeStringsStream.dat' NOT FOUND
'assets/metadata/treeValueStream.dat' NOT FOUND
'assets/metadata/treeNodeStream.dat'...
'assets/metadata/treeStringsStream.dat'...
'assets/metadata/treeValueStream.dat'...
:mergeF0DebugJniLibFolders
:transformNative_libsWithMergeJniLibsForF0Debug
我正在使用GooglePlayServices 9.8.0
根据Android参考,这是语法。 它适用于Android Studio。 https://developers.google.com/android/reference/com/google/android/gms/nearby/messages/Messages.html#subscribe(com.google.android.gms.common.api.GoogleApiClient,%20android.app.PendingIntent,%20com.google.android.gms.nearby.messages.SubscribeOptions)
请帮帮我:)。