在开发,调试和测试Android应用程序时,会发生很多代码异常.几乎每个例外导致一个Android设备(Galaxy Note 3,Android 5.0 - 如果它重要)弹出恼人的"这个应用程序导致你的设备运行缓慢"通知与崩溃统计和建议卸载应用程序.有没有办法摆脱这个烦人的通知?
在Developer Options中将应用程序选为调试应用程序无济于事.
我应该遵循什么规则来设置文件的自定义ID?我尝试了简短的“ 12345”,“ abcde”,44个字符的字母数字字符串,UUID.randomUUID()。toString()(带/不带破折号)-所有尝试均返回“提供的文件ID不可用”。我找不到任何记录的要求。代码:
Drive drive = new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), credentials).build();
FileContent mediaContent = new FileContent("image/png", tempFile);
File body = new File();
body.setId(...);
body.setTitle(...);
body.setMimeType("image/png");
File result = drive.files().insert(body, mediaContent).execute();
Run Code Online (Sandbox Code Playgroud)
响应:
400 Bad Request
{
"code": 400,
"errors":
[{
"domain": "global",
"location": "file.id",
"locationType": "other",
"message": "The provided file ID is not usable",
"reason": "invalid"
}],
"message": "The provided file ID is not usable"
}
Run Code Online (Sandbox Code Playgroud)
当我不尝试设置ID 时,相同的代码会将我的文件正确上传到云端硬盘。