Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating dependencies to Android Jetpack

So I have been migrating my dependencies from support libraries to jetpack mappings as told in this link.

I now encouter an error while building my app which leaves me clueless. I have no idea what causes this error cause it looks like generated resources.

The error is:

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

The error line (8673) is:

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

The new migrated dependencies are:

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'
like image 645
Ruben Aalders Avatar asked May 11 '18 21:05

Ruben Aalders


1 Answers

After a ton of experimentation and searching it seems like the issue can be solved by overriding the style and setting the value in question #000000 to @null.

In your res/values/styles.xml you can add

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

Which should override the original value and fix the issue.

like image 124
Karn Avatar answered Oct 03 '22 13:10

Karn