无法解决资源链接失败错误



我有以下错误,我不知道为什么会发生这种情况。我所做的只是加上国旗调用"mon",并尝试将其添加到xml中的自定义视图中。"mon"作品以外的标志好这个错误的含义是什么?我很想听听你的消息。

Android resource linking failed
Output:  samp/app/src/main/res/layout/layout_mon.xml:2: error: 'mon' is incompatible with attribute mon_type (attr) flags [sol=1, dan=4, tin=2] [weak].
error: failed linking file resources.
Command: /Users/me/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/0c6f710daca8a09e3/aapt2-3.2.1-4818971-osx/aapt2 link -I
/Users/me/Library/Android/sdk/platforms/android-26/android.jar
--manifest
/Users/me/Documents/samp/app/build/intermediates/instant_run_merged_manifests/_stagingDebug/process_stagingDebugManifest/instant-run/AndroidManifest.xml
-o
/Users/me/Documents/samp/app/build/intermediates/processed_res/_stagingDebug/process_stagingDebugResources/out/resources-_stagingDebug.ap_
-R
@/Users/me/Documents/samp/app/build/intermediates/incremental/process_stagingDebugResources/resources-list-for-resources-_stagingDebug.ap_.txt
--auto-add-overlay
--java
/Users/me/Documents/samp/app/build/generated/not_namespaced_r_class_sources/_stagingDebug/process_stagingDebugResources/r
--custom-package
jp.aeonretail.aeon.kidsrepublic
-0
apk
--preferred-density
xxhdpi
--output-text-symbols
/Users/me/Documents/samp/app/build/intermediates/symbols/_st/debug/R.txt
--no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0

//在属性内

<declare-styleable name="MonView">
<attr name="mon_type">
<flag name="sol" value="0x01"/>
<flag name="dan" value="0x02"/>
<flag name="tin" value="0x04"/>
<flag name="mon" value="0x06"/>
</attr>
</declare-styleable>

//查看

<?xml version="1.0" encoding="utf-8"?>
<example.MonView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mon_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:mon_type="mon">
</example.MonView>

您缺少'>'标签

<example.MonView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mon_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:mon_type="mon">
</example.MonView>

相关内容

最新更新