我一直在嘗試解決這個錯誤一個星期了,但仍然無法找到問題。 LogIn正在工作,但由於某些原因,Messenger Messenger崩潰。我無法真正瞭解問題所在。基本上我把文字保存到我的設備上,然後我嘗試分享它。該文件保存到設備(我選中),但Messenger不共享。Android:分享到Facebook 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)
我也嘗試共享的圖像,這已經是我的手機上 - 再次崩潰 – EnderNicky