밝을희 클태

[android studio] APK 만들때 [A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').] ERROR 본문

마모리(My Memory) 프로젝트

[android studio] APK 만들때 [A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').] ERROR

huipark 2023. 11. 2. 19:12

안드로이드 스튜디오에서 APK를 추출하려는데 아래와 같은 에러가 난다. 읽어보면 react native vector icons에서 나는 에러 같은데 

검색해 보면 쉽게 해결법이 나온다.

  • A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').
    • Gradle detected a problem with the following location: '/Users/tom/Documents/GitHub/media/android/app/build/intermediates/ReactNativeVectorIcons'.Possible solutions:
      1. Declare task ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintVitalAnalyzeRelease'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#mustRunAfter.
      Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
    • Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:copyReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
  • 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.

 

아래처럼 코드를 추가 해주면 되는데 node_module의 직접적인 수정은 좋은 방법이 아니지만 다른 방법은 없는 것 같아 임시해결책으론 적당한 거 같다

diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index 5485fac..ef3ccb3 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -26,6 +26,10 @@ afterEvaluate {
 
     android.applicationVariants.all { def variant ->
         def targetName = variant.name.capitalize()
+        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
+        if (lintVitalAnalyzeTask) {
+            lintVitalAnalyzeTask.dependsOn(fontCopyTask)
+        }
         def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
         generateAssetsTask.dependsOn(fontCopyTask)
     }