我一直试图将此错误修复一周,但仍然无法找到问题。 LogIn正在运行,但由于某种原因,Messenger崩溃的共享。我无法真正理解问题所在。基本上我将文本保存到我的设备,然后我尝试分享它。该文件保存到设备(我已选中),但信使不共享。
以下是我的分享代码:
public void shareFile(View view) {
String sayWhat = "This is what you sound like when you write to me, thanks to the app Messenger Say it! Available now at Google Play";
HashMap hashmap = new HashMap();
hashmap.put("utteranceId", sayWhat);
String location = new StringBuilder(Environment.getExternalStorageDirectory().toString()).append("/").append(name).append(".mp3").toString();
speed = ((float)speedS.getProgress()/100F)*2.0F;
pitch=((float)pitchS.getProgress()/100F)*2.0F;
ttsread.setPitch(pitch);
ttsread.setSpeechRate(speed);
ttsread.synthesizeToFile(sayWhat, hashmap, location);
String mimeType = "audio/mpeg";
Uri contentUri = Uri.parse(location);
text.setText(contentUri.toString());
long futuretime = System.currentTimeMillis() + 1000;
while (System.currentTimeMillis() < futuretime) {
synchronized (this) {
try {
wait(futuretime - System.currentTimeMillis());
} catch (Exception e) {
}
}
}
ShareToMessengerParams params = ShareToMessengerParams.newBuilder(contentUri, "audio/mpeg")
.setMetaData("com.facebook.sdk.ApplicationId")
.build();
MessengerUtils.shareToMessenger(this, 1, params);
//MessengerUtils.finishShareToMessenger(activity,params);
}
和我的logcat:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3969)
at android.view.View.performClick(View.java:4637)
at android.view.View$PerformClick.run(View.java:19422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3964)
at android.view.View.performClick(View.java:4637)
at android.view.View$PerformClick.run(View.java:19422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Unsupported URI scheme: null
at com.facebook.messenger.ShareToMessengerParams.<init>(ShareToMessengerParams.java:106)
at com.facebook.messenger.ShareToMessengerParamsBuilder.build(ShareToMessengerParamsBuilder.java:120)
at com.inc.nicky.messengersayit.PersonalSettings.shareFile(PersonalSettings.java:205)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3964)
at android.view.View.performClick(View.java:4637)
at android.view.View$PerformClick.run(View.java:19422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5586)