android - AAPT2 编译失败 : invalid dimen on Android 3. 0 Canary 1

标签 android android-studio android-gradle-plugin aapt android-instant-apps

我正在玩适用于 Android 的 Instant Apps。我安装了所有正确的软件包,并且厌倦了创建具有 Instant App 支持的新应用程序(在创建新应用程序时选中 Instant App 框)。问题是我总是遇到编译工具的问题。有没有其他人有这个问题并且能够找到任何解决方法。

我的环境:

  • Android Studio 3.0 Canary 1
  • 编译SDK:25
  • 构建工具:“26.0.0 rc2”
  • Gradle 插件:3.0.0-alpha1
  • Gradle:尝试了 gradle-4.0-milestone1 和 2
  • Java 1.8/1.7
  • 操作系统:尝试了 Windows 10 和 Linux Ubuntu 16.4 LTS

  • 错误:

    Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
    aapt2 compile -o /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/res/merged/androidTest/debug /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml
    Issues:
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:520 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:521 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:568 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:594 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:595 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:597 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:598 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:599 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:600 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:601 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:602 invalid dimen
     - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:603 invalid dimen
    :feature:mergeDebugAndroidTestResources FAILED
    

    有问题的行包含 (520):
    <item format="float" name="abc_disabled_alpha_material_dark" type="dimen">0.30</item>
    

    希望我为您提供了足够的信息来解决问题。谢谢你。

    最佳答案

    解决方法是将您的开发机器切换到使用“.”的语言环境。作为小数点。

    可以通过以下方式更改:

    enter image description here

    关于android - AAPT2 编译失败 : invalid dimen on Android 3. 0 Canary 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44196672/

    相关文章:

    android - 如何检查 JSON 变量是否存在

    php - 无法在 PHP 中将数据库获取到对象内的数组

    Android Studio 报告日期错误

    尝试包含本地库时 Android Studio Gradle 构建失败

    android - 无法生成未分配的apk文件

    android - Gradle 依赖排除

    javascript - 使用 Javascript 检测触摸屏设备

    android - 我需要用UNITY的Android和IOS应用程序设置保存图片的路径

    android - 如何将我的项目从 Android Studio 添加到我的 GitHub 页面?

    java - 查询网页