gpt4 book ai didi

android - 在 com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@5635bcd2 上找不到属性 'packageApplication'

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:37:27 24 4
gpt4 key购买 nike

这是我的 build.gradle:https://github.com/SnowdreamFramework/android-gradle-template/blob/master/config/android.gradle

当我尝试升级我的项目以使用 gradle 2.2.1 和类路径“com.android.tools.build:gradle:1.0.0-rc1”时,然后我编译并得到如下错误:

$ gradle wrappers --info --stacktrace
Starting Build
Settings evaluated using settings file 'D:\workspace\snowdream\git\android-gradle-template\settings.gradle'.
Projects loaded. Root project using build file 'D:\workspace\snowdream\git\android-gradle-template\build.gradle'.
Included projects: [root project 'android-gradle-template', project ':app', project ':lib']
Evaluating root project 'android-gradle-template' using build file 'D:\workspace\snowdream\git\android-gradle-template\build.gradle'.
Evaluating project ':app' using build file 'D:\workspace\snowdream\git\android-gradle-template\app\build.gradle'.
Compiling script 'D:\workspace\snowdream\git\android-gradle-template\config\android.gradle' using StatementExtractingScriptTransformer.
Compiling script 'D:\workspace\snowdream\git\android-gradle-template\config\android.gradle' using BuildScriptTransformer.
Evaluating project ':lib' using build file 'D:\workspace\snowdream\git\android-gradle-template\lib\build.gradle'.
Sonatype RELEASE BUILD
GITHUB RELEASE BUILD

FAILURE: Build failed with an exception.

* Where:
Script 'D:\workspace\snowdream\git\android-gradle-template\config\android.gradle' line: 68

* What went wrong:
A problem occurred configuring project ':app'.
> Could not find property 'packageApplication' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@5635bcd2.

* Try:
Run with --debug option to get more log output.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:91)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:86)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:65)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:504)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:83)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: groovy.lang.MissingPropertyException: Could not find property 'packageApplication' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@56
at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:94)
at com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated.getProperty(Unknown Source)
at android_4nixinp4pz49dw91skfb0zyxg$_run_closure3.doCall(D:\workspace\snowdream\git\android-gradle-template\config\android.gradle:68)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:63)
at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:165)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:160)
at com.android.build.gradle.AppExtension.addVariant(AppExtension.groovy:52)
at com.android.build.gradle.internal.VariantManager.createVariantApiObjects(VariantManager.java:624)
at com.android.build.gradle.internal.VariantManager.createApiObjects(VariantManager.java:591)
at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:226)
at com.android.build.gradle.internal.VariantManager$createAndroidTasks.call(Unknown Source)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:462)
at com.android.build.gradle.BasePlugin$_createTasks_closure9.doCall(BasePlugin.groovy:407)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy13.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:79)
... 28 more


BUILD FAILED

Total time: 52.699 secs
Stopped 0 compiler daemon(s).

最佳答案

我们必须通过更改我们的代码来以这种方式访问​​ .packageApplication 来解决同样的问题:

 project.android.applicationVariants.all { variant ->
variant = variant as ApplicationVariant // For type inference.
variant.outputs.each { output ->
output = output as ApkVariantOutput // For type inference.
def packageTask = output.packageApplication

关于android - 在 com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@5635bcd2 上找不到属性 'packageApplication',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27209188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com