简体   繁体   中英

Android - Resource not getting linked

My project was running well and suddenly it started showing resource linking failed error. Not able to build the project. Getting the resource linking failed error. It throws me to the values.xml file. But unable to figure out the error.

 Android resource linking failed
    Output:  warn: removing resource com.creditone.admin.OnBoarding:string/logOut without required default value.
    warn: removing resource com.creditone.admin.OnBoarding:string/wrongNumberWarning without required default value.
    E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
    E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
    E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:602: error: resource android:attr/fontVariationSettings not found.
    E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:602: error: resource android:attr/ttcIndex not found.
    error: failed linking references.

    Command: C:\Users\Intel\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\6f8a19afba4ded03991ba2724772ffb5\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
            C:\Users\Intel\AppData\Local\Android\Sdk\platforms\android-27\android.jar\
            --manifest\
            E:\On Boarding App\OnBoardingApp\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
            -o\
            E:\On Boarding App\OnBoardingApp\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
            -R\
            @E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
            --auto-add-overlay\
            --java\
            E:\On Boarding App\OnBoardingApp\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
            --custom-package\
            com.creditone.admin.OnBoarding\
            -0\
            apk\
            --no-version-vectors\
            --output-text-symbols\
            E:\On Boarding App\OnBoardingApp\app\build\intermediates\symbols\debug\R.txt\
            --no-version-vectors
    Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

shows error on below these two lines

App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:602: error: resource android:attr/fontVariationSettings not found.
    E:\On Boarding App\OnBoardingApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:602: error: resource android:attr/ttcIndex not found.

On click of above link it opens values.xml file and shows follwing lines

 <declare-styleable name="FontFamilyFont"><attr name="fontStyle">
            <enum name="normal" value="0"/>
            <enum name="italic" value="1"/>
        </attr><attr format="reference" name="font"/><attr format="integer" name="fontWeight"/><attr format="string" name="fontVariationSettings"/><attr format="integer" name="ttcIndex"/><attr name="android:fontStyle"/><attr name="android:font"/><attr name="android:fontWeight"/><attr name="android:fontVariationSettings"/><attr name="android:ttcIndex"/></declare-styleable>
    <declare-styleable name="ForegroundLinearLayout"><attr name="android:foreground"/><attr name="android:foregroundGravity"/><attr format="boolean" name="foregroundInsidePadding"/></declare-styleable>
    <declare-styleable name="GradientColor">
        <!-- Start color of the gradient. -->
        <attr name="android:startColor"/>
        <!-- Optional center color. -->
        <attr name="android:centerColor"/>
        <!-- End color of the gradient. -->
        <attr name="android:endColor"/>
        <!-- Type of gradient. The default type is linear. -->
        <attr name="android:type"/>

        <!-- Only applied to RadialGradient-->
        <!-- Radius of the gradient, used only with radial gradient. -->
        <attr name="android:gradientRadius"/>

        <!-- Only applied to SweepGradient / RadialGradient-->
        <!-- X coordinate of the center of the gradient within the path. -->
        <attr name="android:centerX"/>
        <!-- Y coordinate of the center of the gradient within the path. -->
        <attr name="android:centerY"/>

        <!-- LinearGradient specific -->
        <!-- X coordinate of the start point origin of the gradient.
             Defined in same coordinates as the path itself -->
        <attr name="android:startX"/>
        <!-- Y coordinate of the start point of the gradient within the shape.
             Defined in same coordinates as the path itself -->
        <attr name="android:startY"/>
        <!-- X coordinate of the end point origin of the gradient.
             Defined in same coordinates as the path itself -->
        <attr name="android:endX"/>
        <!-- Y coordinate of the end point of the gradient within the shape.
             Defined in same coordinates as the path itself -->
        <attr name="android:endY"/>

        <!-- Defines the tile mode of the gradient. SweepGradient doesn't support tiling. -->
        <attr name="android:tileMode"/>
    </declare-styleable>

Please help. Thank you.

: update your compile SDK version to 28. :将您的编译 SDK 版本更新为 28。

: either you or a library you're depending on is trying to use resources from API 28 (ie ttcIndex, fontVariationSettings).:您或您依赖的库正在尝试使用 API 28 中的资源(即 ttcIndex、fontVariationSettings)。 Most likely it's some version of the support library and you have either an explicit version 28 dependency or a "+" dependency, which then uses the newest available version of the library. If your SDK is lower than 28, these resources do not exist in the compile SDK and AAPT2 then fails to link the resources (the references cannot be resolved). Upgrading to the newest SDK (28) should fix this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM