我試圖在Android上傳視頻到YouTube。 我希望用戶使用GoogleAuthUtil通過他的Google帳戶進行驗證,並且工作正常。然後我有用戶名和令牌,也加載了uriFile。Youtube上傳視頻Android
我想要做的最後一步是上傳到Youtube。要做到這一點,我跟着這個代碼https://code.google.com/p/ytd-android/source/browse/trunk/?r=38
我在我的代碼的問題是這部分:
File file = new File(fileUri.getPath());
long mFileSize = file.length();
GoogleCredential credential = new GoogleCredential();
credential.setAccessToken(mToken);
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
YouTube youtube =
new YouTube.Builder(httpTransport, jsonFactory, credential).setApplicationName(
"fanscup").build();
InputStream fileInputStream = null;
try {
mFileSize = getContentResolver().openFileDescriptor(fileUri, "r").getStatSize();
fileInputStream = getContentResolver().openInputStream(fileUri);
} catch (FileNotFoundException e) {
Log.e(getApplicationContext().toString(), e.getMessage());
}
ResumableUpload.upload(youtube, fileInputStream, mFileSize, getApplicationContext());
,當我嘗試上傳我得到這個錯誤的視頻:
Uncaught handler: thread main exiting due to uncaught exception
java.io.FileNotFoundException: /dev/kmsg (Permission denied)
java.io.IOException: Permission denied
resizing JitTable from 4096 to 8192
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.api.client.util.Clock
at com.google.api.client.auth.oauth2.Credential. (Credential.java:200)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.(GoogleCredential.java:187)
at com.library_fanscup.UploadActivity$1.onPostExecute(UploadActivity.java:483)
at com.library_fanscup.UploadActivity$1.onPostExecute(UploadActivity.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
at dalvik.system.NativeStart.main(Native Method)
exception :java.io.FileNotFoundException: /dev/kmsg (Permission denied)
exception :java.io.FileNotFoundException: /dev/kmsg (Permission denied)
java.io.FileNotFoundException: /data/plog.log (Permission denied)
燦有人幫助我?有任何想法嗎?