无法在android studio中创建新活动

bra*_*nky 6 android illegalstateexception android-fragments android-studio

在android studio中创建new时,我在事件日志中不断收到IllegalStateException错误activity:

11:27:15 InvalidReferenceException: Error executing FreeMarker template: The following has evaluated to null or missing:
==> srcDir  [in template "root://activities/common/common_globals.xml.ftl" at line 41, column 34]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use when-presentwhen-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??
Run Code Online (Sandbox Code Playgroud)

小智 7

我遇到了同样的问题,尝试以下步骤对我有用:

  1. 关闭android工作室
  2. 删除文件夹: .idea.gradle
  3. 使用android studio重新打开项目


Dha*_*j M 0

我遇到过同样的问题。访问此链接。 https://code.google.com/p/android/issues/detail?id=232076

如果您的项目位于 C: 驱动器以外的其他驱动器中,则会发生这种情况,android studio 会自动在 C: 驱动器的 tmp 文件夹中创建项目的副本(我希望它们是缓存文件)。此文件夹是导致此问题的原因。

尝试“文件”->“使缓存无效/重新启动”。或者只是删除 c: 驱动器中的 tmp 文件夹并重新启动一切,它将正常工作。