Android - ресурс не связан - PullRequest
       14

Android - ресурс не связан

0 голосов
/ 09 февраля 2019

Мой проект работал хорошо, и внезапно он начал показывать ошибку связывания ресурса.Не удалось построить проект.Ошибка получения ссылки на ресурс.Это бросает меня в файл values.xml.Но не может определить ошибку.

 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

показывает ошибку в этих двух строках

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.

При нажатии на ссылку выше, он открывает файл values.xml и показывает следующие строки

 <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>

Пожалуйста, помогите.Спасибо.

1 Ответ

0 голосов
/ 11 февраля 2019

tl; dr : обновите версию SDK для вашей компиляции до 28.

Более длинный ответ : либо вы, либо библиотека, от которой вы зависите, пытается использоватьресурсы из API 28 (т.е. ttcIndex, fontVariationSettings).Скорее всего, это какая-то версия библиотеки поддержки, и у вас либо явная зависимость версии 28, либо зависимость "+", которая затем использует новейшую доступную версию библиотеки.Если ваш SDK меньше 28, эти ресурсы не существуют в SDK для компиляции, и AAPT2 не может связать ресурсы (ссылки не могут быть разрешены).Обновление до новейшего SDK (28) должно решить эту проблему.

...