java - 创建新 Activity 时出错

标签 java android

我正在尝试创建一个新的 Activity,但出现以下错误(图片底部)

InvalidReferenceException: Error executing FreeMarker template...

如果我通过创建一个扩展 Activity 类的 Java 类来手动创建一个 Activity,那么它就可以工作。

enter image description here

最佳答案

来自以下链接:Cannot create empty activity, in Android Studio 2.2.3 ,有些人有同样的问题:

ERROR - llij.ide.plugins.PluginManager - com.android.tools.idea.templates.FreemarkerUtils$TemplateProcessingException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> manifestDir [in template "root://activities/common/common_globals.xml.ftl" at line 26, column 39]

问题与在C 驱动器上创建的tmp 文件夹有关

When I first installed Android SDK, I installed it to the C drive and did some exercises inside ud851-Exercises-student there. Then, because I ran out of space on the C drive, I uninstalled it from C and installed it to D. Maybe I accidentally opened one of those projects and that cause the Android Studio to create the tmp folder in C.

删除C:\tmp文件夹解决了问题

I was having the same issue...deleting tmp folder helped.

有关根本原因的更多信息:

I realized this issue is because of the "buildDir" path in build.gradle file in Udacity projects. See screen shot.

enter image description here

关于java - 创建新 Activity 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42946819/

相关文章:

java - 使用循环在一个类中为另一个类的多个实例中的按钮添加 ActiveListener

java - system.out 之后的 hibernate 代理对象

android - 数据未从 Android 应用程序写入 Firebase 实时数据库

android - PhoneGap 从服务器 html 文件重定向到本地文件

android - getActivity() 在 fragment 的 AlertDialog 内为 null

java - 使用 recyclerView 项目的一些 `put extra` onClick 返回到上一个 Activity

java - gwt-maven-插件 : Only generate necessary js files

android - 在 Tablayout 上禁用 Material Ripple

java - playframework 2.3.x 堆大小

android - 可以同时运行两个 Activity 吗?