【问题标题】:Error : String types not allowed (at 'theme' with value ") in android studio错误:在 android studio 中不允许使用字符串类型(在“主题”处带有值“)
【发布时间】:2016-08-06 17:22:12
【问题描述】:

当我运行 android studio 时,我不断收到这个错误:

:app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE :app:preReleaseBuild UP-TO-DATE :app:checkDebugManifest :app:preDebugBuild UP-TO-DATE :app:preBuild UP-TO-DATE 信息:构建失败 :app:prepareComAndroidSupportDesign2321Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72321Library :app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2321Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl 最新 :app:compileDebugRenderscript 最新 :app:generateDebugBuildConfig 最新 :app:generateDebugAssets 最新 :app:mergeDebugAssets 最新 :app:generateDebugResValues 最新 :app:generateDebugResources 最新 :app:mergeDebugResources 最新 :app:processDebugManifest 最新 :app:processDebugResources

C : \Users\User\Desktop\UniTools\app\build\intermediates\exploded- aar\com.android.support\appcompat-v7\23.2.1\res\values\values.xml

错误:(315, 5) 不允许使用字符串类型(在 'theme' 处,值为 '')。 错误:任务“:app:processDebugResources”执行失败。 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\User\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' 以非零退出值 1 结束

 <style name="Base.TextAppearance.AppCompat.SearchResult" parent="">
    <item name="android:textStyle">normal</item>
    <item name="android:textColor">?android:textColorPrimary</item>
    <item name="android:textColorHint">?android:textColorHint</item>
</style>

然后 Android Studio 在 values.xml 中给我这个代码。关于问题是什么的任何想法?

【问题讨论】:

  • 你为什么有parent=""
  • 是这个问题吗?我从未编辑过 values.xml。
  • 如果我把它拿出来运行它会自动返回
  • 不要让父母="
  • 移除父属性

标签: java android string


【解决方案1】:

从资源管理器中编辑您的“values.xml”:找到 values.xml->在记事本中编辑-> 重建项目。

您正在尝试编辑生成的文件,因此 parent="" 一次又一次地出现。因为你不能编辑生成的文件

【讨论】:

  • 它似乎仍在 Android Studio 中变回?我已经在记事本中编辑了它,保存并重建了应用程序
【解决方案2】:

您将空值分配给“主题”

我认为styles.xml中的'theme'或者你可以在'values'文件夹下的xml文件中搜索'theme'。

然后检查您为“主题”分配的值

【讨论】:

    【解决方案3】:

    我也有类似的问题。要解决它,只需在记事本中编辑values.xml 文件并保存它,那么您应该可以开始使用了。 转至build/intermediates/ress/merged/debug/values

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 1970-01-01
      相关资源
      最近更新 更多