《Daily bugs-小王日常捉虫记》
BUG-0001.Error:Failed to resolve: annotationProcessor 1 2 3 repositories { maven { url 'https://jitpack.io' } }
原版本
1 2 3 4 5 6 allprojects { repositories { jcenter() maven { url 'https://maven.google.com' } } }
0001参考链接
BUG0002.Android studio3.0升级稳定版 Cannot set the value of read-only property ‘outputFile’ for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN
解决方案:
Change each -> to all
Change output.outputFile -> to outputFileName
before:
1 2 3 4 5 6 7 8 9 10 android.applicationVariants.all { variant -> variant.outputs.each { output -> def finalVersionCode = v10000 + versionCode output.versionCodeOverride = finalVersionCode output.outputFile = new File ( output.outputFile.parent, output.outputFile.name.replace(".apk" ,"-${finalVersion}.apk" )) } }
after:
1 2 3 4 5 6 7 8 9 10 android.applicationVariants.all { variant -> variant.outputs.all { output -> def finalVersionCode = 10000 + versionCode output.versionCodeOverride = finalVersionCode outputFileName = new File ( output.outputFile.parent, outputFileName.replace(".apk" , "-${finalVersionCode}.apk" )) } }
apply:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 applicationVariants.all { variant -> variant.outputs.all { output -> def apkFileName = "" if (outputFileName != null && outputFileName.endsWith('app-debug.apk' )) { apkFileName = appName + "_" + defaultConfig.versionName + "_debug.apk" } if (outputFileName != null && outputFileName.endsWith('app-release-unsigned.apk' )) { apkFileName = appName + "_" + defaultConfig.versionName + "_release_unsigned.apk" } outputFileName = new File (apkOutDir.equals("" ) ? outputFileName : apkOutDir, apkFileName) } }
0002参考链接
BUG0003.Error: style attribute ‘@android:attr/windowExitAnimation’ not found All the problem was solved already.
Cause of the problem:
There are two modules, A_module, B_module.
B_module has a style:
1 2 3 4 5 6 <style name ="my_style”> <item name=" @android:windowEnterAnimation ">@anim/anim_toast_show</item > <item name ="@android:windowExitAnimation" > @anim/anim_toast_hide</item > </style >
If B_module compile(':A_module')
Build or Clean, report a error location in A_module->Res->values->styles:
Error:(94, 5) style attribute ‘@android:attr/windowExitAnimation’ not found Error:(94, 5) style attribute ‘@android:attr/windowEnterAnimation’ not found
Solution: Removing the "@"
at the start of the item name.
1 2 <item name ="@android:windowEnterAnimation" > @anim/anim_toast_show</item > <item name ="@android:windowExitAnimation" > @anim/anim_toast_hide</item >
to:
1 2 <item name ="android:windowEnterAnimation" > @anim/anim_toast_show</item > <item name ="android:windowExitAnimation" > @anim/anim_toast_hide</item >
0003参考链接
BUG0004. BUG0005. BUG0006. BUG0007. BUG0008. BUG0009.