I get many errors when I try to run on Android studio.

Asked 1 years ago, Updated 1 years ago, 70 views

An error message similar to the following appears:

Android resource linking failed
ERROR: C:\Users\berdy\AndroidStudioProjects\Janken\app\src\main\res\layout\activity_main.xml:26:AAPT: error: '100' is incompatible with attribute layout_width(attr) dimension | enum [fill_parent=429499,content=42952_present=42952

Execution failed for task ':app:processDebugResources'.
>A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   >Android resource linking failed
     ERROR: C:\Users\berdy\AndroidStudioProjects\Janken\app\src\main\res\layout\activity_main.xml:26:AAPT: error: '100' is incompatible with attribute layout_width(attr) dimension | enum [fill_parent=429499,content=42952_present=42952

* Try:
Run with --stacktrace option to get the stack trace. Run with -- info or -- debug option to get more log output. Run with -- scan to get full insights.

android android-studio

2022-09-30 17:27

1 Answers

The error message is displayed in
"'100' is incompatible with attribute layout_width(attr) dimension"
[Direct translation] '100' does not match the layout_width attribute.
That's what it is.

The unit "dp" is used to specify the width and height of the Android element, so if you modify '100' to '100dp', the error will be resolved.

In the same way, adding dp to the end of the number should resolve any other error such as incompatible xxxxx attribute xxxxx(attr) dimension, so please try to correct it.

Supplemental:
dp means (Density-independent pixel).


2022-09-30 17:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.