Android resource linking failed

小弟為Android studio新手,用了AS 開啟github上提供的AprilBeaconDemos_android_studio文件出現以下錯誤訊息,請問如何解決,另外文件中的R都會出現紅色的錯誤cannot resolve symbol 'R',不知道是否有關連。

   Android resource linking failed
Output:  warn: removing resource com.aprbrother.aprilbeacondemos:string/advinterval without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/battery without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/cancel without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_model_to_ibeacon without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_model_to_ibeacon_uid_url without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_model_to_uid without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_model_to_ulr without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_uid without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_uid_custom without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_uid_name_space without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/change_url without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/current_model without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/firmware_version without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/getBattery without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/get_advinterval without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/get_device_info without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/get_firmware_version without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/get_manufacturer without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/get_transmitting_power without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/input_password without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/manufacturer without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/modify_beacon without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/start_background_notify without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/start_modify without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/sure without required default value.
warn: removing resource com.aprbrother.aprilbeacondemos:string/transmitting_power without required default value.
E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/fontStyle not found.
E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/font not found.
E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/fontWeight not found.
error: failed linking references.

Command: C:\Users\user\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4b861536d966c8af1cbf767deafa585e\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
        C:\Users\user\AppData\Local\Android\Sdk\platforms\android-25\android.jar\
        --manifest\
        E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        com.aprbrother.aprilbeacondemo\
        -0\
        apk\
        --output-text-symbols\
        E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/fontStyle not found.
E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/font not found.
E:\Users\user\AndroidStudioProjects\AprilBeaconDemos_android_studio\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:208: error: resource android:attr/fontWeight not found

在project的build.gradle中添加
maven { url "https://maven.google.com" }

1 Like

hello hell!, 我在build apk時也遇到這個問題 maven也加入了build.gradle中,但是仍然沒有作用