Java 将文件上载到Google驱动器存在插入功能问题

Java 将文件上载到Google驱动器存在插入功能问题,java,google-drive-api,Java,Google Drive Api,我正试图上传文件到谷歌硬盘 我从这里得到的部分代码 这是有错误的代码的一部分 private File insertFile(com.google.api.services.drive.Drive service, String title, String description, String parentId, String mimeType, final String filename) { // File's metadata.

我正试图上传文件到谷歌硬盘

我从这里得到的部分代码

这是有错误的代码的一部分

private File insertFile(com.google.api.services.drive.Drive service, String title, String description,
                        String parentId, String mimeType, final String filename) {
    // File's metadata.
    File body = new File();
    body.setTitle(title);
    body.setDescription(description);
    body.setMimeType(mimeType);

    // Set the parent folder.
    if (parentId != null && parentId.length() > 0) {
        body.setParents(Collections.singletonList(new ParentReference().setId(parentId)));
    }

    // File's content.
    java.io.File fileContent = new java.io.File(filename);
    if(!fileContent.canRead()) {
        ((Activity)context).runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Dialog wrong = new Dialog(context);
                wrong.setTitle("file ("+filename+") is not readable");
                wrong.show();
            }
        });
        return null;
    }


    FileContent mediaContent = new FileContent(mimeType, fileContent);

    try {
        com.google.api.services.drive.Drive.Files.Insert insert = service.files().insert(body,mediaContent);

        MediaHttpUploader uploader = insert.getMediaHttpUploader();
        uploader.setChunkSize(1 * 1024 * 1024);
        uploader.setProgressListener(new FileUploadProgressListener(filename));

        File file = insert.execute();

        return file;
    } catch (IOException e) {
        Log.e(TAG, "ERROR OCCURED : " + e);
        return null;
    }
}
我无法生成项目,出现错误:

Error:(464, 13) error: cannot find symbol method setTitle(String)
Error:(470, 54) error: incompatible types: List<ParentReference> cannot be converted to List<String>
Error:(491, 54) error: cannot find symbol class Insert
Error:(491, 86) error: cannot find symbol method insert(File,FileContent)
错误:(464,13)错误:找不到符号方法setTitle(字符串)
错误:(470,54)错误:不兼容的类型:无法将列表转换为列表
错误:(491,54)错误:找不到符号类插入
错误:(491,86)错误:找不到符号方法插入(文件,FileContent)
你知道吗