Androidresourcelinkingfailed
⼀.Android resource linking failed
错误⽇志1
Android resource linking failed
Output: error: resource style/Theme.AppCompat.Light.DarkActionBar (aka
com.hp.sortfilebysize:style/Theme.AppCompat.Light.DarkActionBar) not found.
压抑的反义词E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:9: error: style attribute 'attr/colorPrimary (aka com.hp.sortfilebysize:attr/colorPrimary)' not found.
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:10: error: style attribute 'attr/colorPrimaryDark (aka com.hp.sortfilebysize:attr/colorPrimaryDark)' not found.
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:11: error: style attribute 'attr/colorAccent (aka com.hp.sortfilebysize:attr/colorAccent)' not found.
error: failed linking references.
Command: C:\Urs\tangdekun\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-beta03-4818971-
windows.jar\868db5e9c484c628dee78cdbe6877651\aapt2-3.2. link -I\
N:\ProgramFiles\android\sdk\platforms\android-28\android.jar\
--manifest\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\l\
-o\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\procesd_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
E:\ASWorkSpace\SortFileBySize\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.hp.sortfilebysize\
-0\
apk\
--output-text-symbols\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\symbols\\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-beta03-4818971-windows Daemon #0
错误⽇志2
Android resource linking failed
Output: E:\ASWorkSpace\SortFileBySize\app\src\main\res\layout\l:13: error: attribute
按摩教程layout_constraintBottom_toBottomOf (aka com.hp.sortfilebysize:layout_constraintBottom_toBottomOf) not found.
E:\ASWorkSpace\SortFileBySize\app\src\main\res\layout\l:13: error: attribute layout_constraintLeft_toLeftOf (aka com.hp.sortfilebysize:layout_constraintLeft_toLeftOf) not found.
E:\ASWorkSpace\SortFileBySize\app\src\main\res\layout\l:13: error: attribute
layout_constraintRight_toRightOf (aka com.hp.sortfilebysize:layout_constraintRight_toRightOf) not found.
E:\ASWorkSpace\SortFileBySize\app\src\main\res\layout\l:13: error: attribute layout_constraintTop_toTopOf (aka com.hp.sortfilebysize:layout_constraintTop_toTopOf) not found.
error: failed linking file resources.
Command: C:\Urs\tangdekun\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-beta03-4818971-
windows.jar\868db5e9c484c628dee78cdbe6877651\aapt2-3.2. link -I\
N:\ProgramFiles\android\sdk\platforms\android-28\android.jar\
--manifest\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\l\
-o\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\procesd_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
E:\ASWorkSpace\SortFileBySize\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.hp.sortfilebysize\
-0\
apk\
--output-text-symbols\
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\symbols\\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-beta03-4818971-windows Daemon #0
错误⽇志3
Android resource linking failed
Output: E:\ASWorkSpace\Temp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-
E:\ASWorkSpace\Temp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:11: error: resource android:attr/dialogCornerRadius not found.
E:\ASWorkSpace\Temp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:946: error: resource android:attr/fontVariationSettings not found.
E:\ASWorkSpace\Temp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\l:946: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Urs\tangdekun\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-beta03-4818971-
windows.jar\868db5e9c484c628dee78cdbe6877651\aapt2-3.2. link -I\
N:\ProgramFiles\android\sdk\platforms\android-27\android.jar\
--manifest\
E:\ASWorkSpace\Temp\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.x ml\
-o\
E:\ASWorkSpace\Temp\app\build\intermediates\procesd_res\debug\processDebugResources\out\resources-
debug.ap_\
-R\
喊麦词
@E:\ASWorkSpace\Temp\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
E:\ASWorkSpace\Temp\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
p\
-0\种一棵树
apk\
--output-text-symbols\
E:\ASWorkSpace\Temp\app\build\intermediates\symbols\\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-beta03-4818971-windows Daemon #0
问题出现的原因:
Android studio升级到3.0以上,⼯程⾃动会引⼊Androidx的相关包,当因为某些原因,我们把默认依赖删除以后,就会出现Android resource linking failed,错误⽇志1是缺少androidx.appcompat:appcompat:1.0.0-alpha1依赖,错误⽇志2是缺少
错误⽇志3是因为compileSdkVersion版本不对,应该改为compileSdkVersion 28
解决⽅案
添加相关依赖即可,如下:
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
祖孙三代implementation 'straintlayout:constraintlayout:1.1.2'
1
2
⼆. java.lang.ClassNotFoundException
Caud by: java.lang.ClassNotFoundException: Didn't find class "android.t.FileProvider4Util" on path: DexPathList[[zip file "/data/app/p-1/ba.apk"],nativeLibraryDirectories=[/data/app/p-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /oem/lib, /oem/lib]]
at dalvik.system.BaDexClassLoader.findClass(BaDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
退部申请书at android.app.ActivityThread.installProvider(ActivityThread.java:5962)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5545)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5484)
at android.app.ActivityThread.-wrap2(ActivityThread.java)解三次方程
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
人民行使国家权力的机关是
at android.app.ActivityThread.main(ActivityThread.java:6251)
at flect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Suppresd: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/FileProvider;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
... 12 more
Caud by: java.lang.ClassNotFoundException: Didn't find class "android.t.FileProvider" on path: DexPathList[[zip file "/data/app/p-1/ba.apk"],nativeLibraryDirectories=[/data/app/p-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /oem/lib, /oem/lib]]
at dalvik.system.BaDexClassLoader.findClass(BaDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
原因分析:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28