美文网首页Android问题汇总(遥远的回忆过去)
android/flutter 打包报错 ':app:lintV

android/flutter 打包报错 ':app:lintV

作者: MonkeyLei | 来源:发表于2019-09-26 10:55 被阅读0次

    最近搞的一个flutter小项目,也是给同学用的一个东东。微信开发平台申请通过了,准备接入分享微信和朋友圈的功能,然后找了一个三方的flutter分享库。也是各种折腾了一天,作者也帮忙搞了搞,但是没怎么搞定! debug运行没问题,就是release版本打包的时候出问题了...

    各种报错如下:

        FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:lintVitalRelease'.
    > Could not resolve all artifacts for configuration ':app:dynamicProfileRuntimeClasspath'.
       > Could not resolve project :fluwx.
         Required by:
             project :app
          > java.lang.NullPointerException (no error message)
    
    

    很多方法都尝试了。包括更换gradle版本,kotlin版本,以及网上能搜到的各种方式。完事了flutter build apk还是报错。 不行了,然后就用AS打开flutter工程下的android工程,采用AS打包的方式打包,看看报错。 然后也是各种尝试,版本匹配了,也同步成功了,打包还是一样的错误,不过错误更细致了:

      Configure project :app
    WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
    WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
    
    Configure project :fluwx
    WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
    
    Task :app:lintVitalRelease FAILED
    135 actionable tasks: 4 executed, 131 up-to-date
    *********************************************************
    WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
    See https://goo.gl/CP92wY for more information on the problem and how to fix it.
    This warning prints for all Android build failures. The real root cause of the error may be unrelated.
    *********************************************************
    
    FAILURE: Build failed with an exception.
    
    What went wrong:
    Execution failed for task ':app:lintVitalRelease'.
    Could not resolve all artifacts for configuration ':app:dynamicProfileRuntimeClasspath'.
    Could not resolve project :fluwx.
    Required by:
    project :app
    > java.lang.NullPointerException (no error message)
    
    Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for con
    figuration ':app:dynamicProfileRuntimeClasspath'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1054)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1700(DefaultConfiguration.java:123)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationArtifactCollection.ensureResolved(DefaultConfiguration.
    java:1489)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationArtifactCollection.getArtifacts(DefaultConfiguration.ja
    va:1461)
    at com.android.build.gradle.internal.ide.dependencies.ArtifactDependencyGraph.createDependencies(ArtifactDependencyGraph.java:226)
    at com.android.build.gradle.internal.ide.ModelBuilder.getDependencies(ModelBuilder.java:815)
    at com.android.build.gradle.internal.ide.ModelBuilder.createAndroidArtifact(ModelBuilder.java:919)
    at com.android.build.gradle.internal.ide.ModelBuilder.createVariant(ModelBuilder.java:583)
    at com.android.build.gradle.internal.ide.ModelBuilder.buildAndroidProject(ModelBuilder.java:399)
    at com.android.build.gradle.internal.ide.ModelBuilder.buildAll(ModelBuilder.java:212)
    at com.android.build.gradle.internal.AppModelBuilder.buildAll(AppModelBuilder.kt:71)
    at com.android.tools.lint.gradle.LintGradleExecution.createAndroidProject(LintGradleExecution.java:358)
    at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.java:85)
    at com.android.tools.lint.gradle.api.ReflectiveLintRunner.runLint(ReflectiveLintRunner.kt:38)
    at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:93)
    at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:57)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
    ... 31 more
    Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve project :fluwx.
    Required by:
    project :app
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.calculateTargetConfigurations(EdgeState.java:169)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.attachToTargetConfigurations(EdgeState.java:112)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.attachToTargetRevisionsSerially(Dependency
    GraphBuilder.java:315)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolveEdges(DependencyGraphBuilder.java:2
    
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:126)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.jav
    a:123)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolveGraph(DefaultConfigurationResolver.java:167)
    at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolveGraph(ShortCircuitEmptyConfigurationResolver.ja
    va:89)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:73)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$5.run(DefaultConfiguration.java:533)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:524)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:509)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1800(DefaultConfiguration.java:123)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguratio
    n.java:1037)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.access$3100(DefaultConfiguration.java:97
     at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationArtifactCollection.ensureResolved(DefaultConfiguration.
    java:1483)
    ... 58 more
    Caused by: java.lang.NullPointerException
    at com.google.common.collect.UsingToStringOrdering.compare(UsingToStringOrdering.java:33)
    at org.gradle.api.internal.attributes.DefaultDisambiguationRuleChain$ExceptionHandler.handleException(DefaultDisambiguationRuleChain.java:99)
    at org.gradle.api.internal.attributes.DefaultDisambiguationRuleChain$ExceptionHandler.handleException(DefaultDisambiguationRuleChain.java:87)
    at org.gradle.internal.action.InstantiatingAction.execute(InstantiatingAction.java:44)
    at org.gradle.api.internal.attributes.DefaultDisambiguationRuleChain.execute(DefaultDisambiguationRuleChain.java:75)
    at org.gradle.api.internal.attributes.DefaultDisambiguationRuleChain.execute(DefaultDisambiguationRuleChain.java:38)
    at org.gradle.api.internal.attributes.DefaultAttributesSchema$MergedSchema.disambiguate(DefaultAttributesSchema.java:183)
    at org.gradle.internal.component.model.MultipleCandidateMatcher.disambiguateWithAttribute(MultipleCandidateMatcher.java:215)
    at org.gradle.internal.component.model.MultipleCandidateMatcher.disambiguateWithRequestedAttributes(MultipleCandidateMatcher.java:202)
    at org.gradle.internal.component.model.MultipleCandidateMatcher.disambiguateCompatibleCandidates(MultipleCandidateMatcher.java:192)
    at org.gradle.internal.component.model.MultipleCandidateMatcher.getMatches(MultipleCandidateMatcher.java:111)
    at org.gradle.internal.component.model.ComponentAttributeMatcher.match(ComponentAttributeMatcher.java:123)
    at org.gradle.api.internal.attributes.DefaultAttributesSchema$DefaultAttributeMatcher.matches(DefaultAttributesSchema.java:156)
    at org.gradle.internal.component.model.AttributeConfigurationSelector.selectConfigurationUsingAttributeMatching(AttributeConfigurationSelecto
    r.java:40)
    at org.gradle.internal.component.model.LocalComponentDependencyMetadata.selectConfigurations(LocalComponentDependencyMetadata.java:117)
    at org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper.selectConfigurations(DslOriginDependencyMetadataWrapper.java:
    60)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.calculateTargetConfigurations(EdgeState.java:166)
    ... 79 more
    
    Get more help at https://help.gradle.org
    BUILD FAILED in 3s
    PS D:\AndroidWorkspace\wx_advmanager\android>
    

    最后,我用在AS打包下的工程,将配置修改为如下:

    fluwx: ^1.0.0    ->如果后面采用这种方式解决的童鞋,可以试试版本升级到最新应该也可以;看情况
    gradle->distributionUrl=https://services.gradle.org/distributions/gradle-4.10.3-all.zip
    kotlin-> 1.3.31
    

    然后用As打包打开的flutter的android,然后编译就可以成功。

    image

    然而: 回到flutter在teminal里面采用flutter build apk 依然还是不行。

    image

    又摸索了一下网上。看了几篇国外的帖子,找到了一个方案(没找到真正不让我心不慌的方案)。

    facebook/react-native#5752

        如下解决:
    @danhawkes I actually fixed it by adding:
    lintOptions { checkReleaseBuilds false }
    in build.gradle, now installRelease works.
    

    国内找了很多类似Execution failed for task ':app:lintVitalRelease'.错误的解决方式。基本也都是这样搞:

    image

    好吧。。先这样。毕竟三方库,别人用着可以。但是自己不知道环境哪里有点区别,导致相关问题,或者三方兼容。或者自己环境。先做个记录。至少目前这样打包出来,运行没啥问题。。。。

    image image

    有机会自己也基于之前三方的jar包,自己做一个插件的封装试试看。。。比如把友盟的看看能不能封装一下呢??

    Flutter 插件开发:以微信SDK为例

    相关文章

      网友评论

        本文标题:android/flutter 打包报错 ':app:lintV

        本文链接:https://www.haomeiwen.com/subject/udohyctx.html