创建 google 驱动器文件时出现 FileNotFoundException

FileNotFoundException when CREATING a google drive file

我在 google 上有一个设置了 firebase 的应用程序,用户可以登录该应用程序,我希望能够存储应用程序数据。

GoogleSignInOptions 设置如下

GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
            .requestEmail()
            .requestScopes(Scope(Scopes.DRIVE_APPFOLDER))
            .build()

并且 createFile 方法是

public Task<String> createFile() {
        return Tasks.call(mExecutor, () -> {
            File fileMetadata = new File();
            fileMetadata.setName("profile.json");
            fileMetadata.setParents(Collections.singletonList("appDataFolder"));

            java.io.File filePath = new java.io.File("profile.json");

            FileContent mediaContent = new FileContent("application/json", filePath);

            File file = mDriveService.files().create(fileMetadata, mediaContent)
                    .setFields("id")
                    .execute();

            return file.getId();
        });
    }

但由于某些原因,调用createFile方法抛出如下异常

java.io.FileNotFoundException: profile.json (No such file or directory)

为什么?对于更多上下文,这是在应用程序的调试版本中测试的

原来有问题的行是

 java.io.File filePath = new java.io.File("profile.json");

我需要输入文件的真实路径而不仅仅是 "profile.json"