9

因此,我一直在将我的依赖项从支持库迁移到此链接中所述的 jetpack 映射。

我现在在构建我的应用程序时遇到了一个错误,这让我一无所知。我不知道是什么导致了这个错误,因为它看起来像是生成的资源。

错误是:

Android resource linking failed
Output:  C:\Users\Ruben\Documents\Bowvie\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:8673: error: expected reference but got (raw string) #000000.
error: failed linking references.

Command: C:\Users\Ruben\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-alpha14-4748712-windows.jar\90bbfcfb9476bccff8420ad6f86bed60\aapt2-3.2.0-alpha14-4748712-windows\aapt2.exe link -I\
        C:\Users\Ruben\AppData\Local\Android\Sdk\platforms\android-P\android.jar\
        --manifest\
        C:\Users\Ruben\Documents\Bowvie\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        C:\Users\Ruben\Documents\Bowvie\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @C:\Users\Ruben\Documents\Bowvie\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        C:\Users\Ruben\Documents\Bowvie\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        nl.fdyr.movies\
        -0\
        apk\
        --output-text-symbols\
        C:\Users\Ruben\Documents\Bowvie\app\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.0-alpha14-4748712-windows Daemon #0

错误行(8673)是:

<style name="Widget.Support.CoordinatorLayout" parent="android:Widget">
    <item name="statusBarBackground">#000000</item>
</style>

新迁移的依赖项是:

implementation 'com.google.android.material:material:1.0.0-alpha1'
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.cardview:cardview:1.0.0-alpha1'
implementation 'androidx.browser:browser:1.0.0-alpha1'
implementation 'androidx.annotation:annotation:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
implementation 'androidx.annotation:annotation:1.0.0-alpha1'
implementation 'androidx.slice:slice-core:1.0.0-alpha1'
implementation 'androidx.slice:slice-builders:1.0.0-alpha1'
4

1 回答 1

16

经过大量的实验和搜索后,似乎可以通过覆盖样式并将有问题的值设置#000000@null.

在你的res/values/styles.xml你可以添加

<style name="Widget.Support.CoordinatorLayout" parent="android:Widget"> <item name="statusBarBackground">@null</item> </style>

哪个应该覆盖原始值并解决问题。

于 2018-05-17T03:45:14.590 回答