Android Studio的即时运行无效的增量更改记录

时间:2016-04-25 08:04:06

标签: android android-studio android-studio-2.0 android-instant-run

构建我的应用时出现此错误:

Error:Execution failed for task ':app:transformClasses_enhancedWithInstant+reloadDexForDebug'.
java.io.IOException: Invalid incremental change record : CHANGED,C:\Users\gingo\Documents\Dropbox (SKOUMAL, s.r.o.)\work\myproject\MyProject\app\build\intermediates\transforms\instantRun\debug\folders\4000\5\enhanced\com\android\tools\fd\runtime\AppPatchesLoaderImpl.class

摆脱它的唯一方法是Build -> Rebuild project

1 个答案:

答案 0 :(得分:1)

项目路径中的罪魁祸首是,(逗号)。只需将其移除即可。

让我解释一下。原因可以在ChangeRecords.java文件中找到。在方法load(File file)中,它从文件中解析一些更改记录,并使用,(逗号)作为行字段的分隔符。查看方法的完整代码:

/**
 * Load change records from a persisted file.
 */
@NonNull
static ChangeRecords load(File file) throws IOException {
    ChangeRecords changeRecords = new ChangeRecords();
    List<String> rawRecords = Files.readLines(file, Charsets.UTF_8);
    for (String rawRecord : rawRecords) {
        StringTokenizer st = new StringTokenizer(rawRecord, ",");
        if (st.countTokens() != 2) {
            throw new IOException("Invalid incremental change record : " + rawRecord);
        }
        changeRecords.add(Status.valueOf(st.nextToken()), st.nextToken());
    }
    return changeRecords;
}