错误:-Android资源链接失败,如何解决?

时间:2019-07-24 04:18:53

标签: android android-studio

在构建我的应用程序时,出现此错误。该如何解决?

Android resource linking failed
C:\Users\Dasun Tharanga\.gradle\caches\transforms-2\files-2.1\e51dea7aad9fc20032a5d423af4d220f\res\layout\preference_widget_seekbar.xml:27: warn: generated id 'android:id/icon' for external package 'android'.
C:\Users\Dasun Tharanga\.gradle\caches\transforms-2\files-2.1\e51dea7aad9fc20032a5d423af4d220f\res\layout\preference_widget_seekbar.xml:53: warn: generated id 'android:id/summary' for external package 'android'.
C:\Users\Dasun Tharanga\.gradle\caches\transforms-2\files-2.1\e51dea7aad9fc20032a5d423af4d220f\res\layout\preference_widget_seekbar.xml:45: warn: generated id 'android:id/title' for external package 'android'.
warn: removing resource com.slstudio.ecommerce:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.
D:\Android\Codecanyon\codecanyon-20952416-android-ecommerce-universal-android-ecommerce-store-full-mobile-app-with-laravel-cms\Android App Source Code\ecommerce\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2787: error: style attribute 'attr/colorError (aka com.slstudio.ecommerce:attr/colorError)' not found.
error: failed linking references.

4 个答案:

答案 0 :(得分:0)

那是SDK版本26中的错误

在应用程序build.gradle中更新SDK版本

compileSdkVersion 29
buildToolsVersion "29.0.0"

答案 1 :(得分:0)

使缓存无效/重新启动后,出现此错误

  

Blockquote   Android资源链接失败   警告:删除资源com.slstudio.ecommerce:string / com_facebook_loginview_logged_in_using_facebook_f1gender,而无需默认值。   \?\ D:\ Android \ Codecanyon \ codecanyon-20952416-android-ecommerce-universal-android-ecommerce-store-full-mobile-app-with-laravel-cms \ Android App源代码\ ecommerce \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values-v28 \ values-v28.xml:7:错误:未找到资源android:attr / dialogCornerRadius。   \?\ D:\ Android \ Codecanyon \ codecanyon-20952416-android-ecommerce-universal-android-ecommerce-store-full-mobile-app-with-laravel-cms \ Android App源代码\ ecommerce \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values-v28 \ values-v28.xml:11:错误:未找到资源android:attr / dialogCornerRadius。   D:\ Android \ Codecanyon \ codecanyon-20952416-android-ecommerce-universal-android-ecommerce-store-full-mobile-app-with-laravel-cms \ Android App Source Code \ ecommerce \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:5101:错误:未找到资源android:attr / fontVariationSettings。   D:\ Android \ Codecanyon \ codecanyon-20952416-android-ecommerce-universal-android-ecommerce-store-full-mobile-app-with-laravel-cms \ Android App Source Code \ ecommerce \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:5102:错误:未找到资源android:attr / ttcIndex。   错误:链接引用失败。   引用

答案 2 :(得分:0)

根据自己的需要尝试:

describe('AppComponent', () => {
    let component: AppComponent;
    let fixture: ComponentFixture<AppComponent>;

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            declarations: [AppComponent],
            providers: [
              { provide: RoutingService, useValue: MockRoutingService },
              { provide: AuthenticationService, useValue: MockAuthenticationService }],
            // imports: [FormsModule] // import the FormsModule if you want ngModel to be working inside the test
            schemas: [NO_ERRORS_SCHEMA] // remove the FormsModule import and use that schema to only shallow test your component. Please refer to the official document for more information.
        })
            .compileComponents();
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(AppComponent);
        component = fixture.componentInstance;
    });

    it('should be created', () => {
      fixture.detectChanges();
      expect(component).toBeTruthy();
    });
});

答案 3 :(得分:0)

我通过以下操作解决了这个问题:

  1. 转到Assets / AndroidServicesResolver / Android / ForceResolve
  2. 一旦解析完成,请删除所有重复的aar文件。
  3. 现在构建。