当前位置: 首页 > 知识库问答 >
问题:

为什么Proguard在使用“minifyEnabled true”时不能工作?

莫兴言
2023-03-14
WARNING [Project: :phone] Support for libraries with same package name is deprecated and will be removed in 1.0
running signingConfigs
running proguard

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':phone'.
> Could not generate a proxy class for class proguard.gradle.ProGuardTask.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
buildTypes {
        release {
            println "running proguard"
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            signingConfig signingConfigs.release
        }
        debug {
            debuggable true
        }
    }

只是需要一些帮助知道去哪里找...谢了。

全stacktrace

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':phone'.
        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)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class proguard.gradle.ProGuardTask.
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:204)
        at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:67)
        at org.gradle.api.internal.project.taskfactory.TaskFactory.createTaskObject(TaskFactory.java:116)
        at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:81)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:99)
        at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:52)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:83)
        at com.android.build.gradle.BasePlugin.createProguardTasks(BasePlugin.groovy:2776)
        at com.android.build.gradle.BasePlugin$createProguardTasks$31.callCurrent(Unknown Source)
        at com.android.build.gradle.BasePlugin.createPostCompilationTasks(BasePlugin.groovy:2021)
        at com.android.build.gradle.internal.variant.ApplicationVariantFactory.createTasks(ApplicationVariantFactory.java:189)
        at com.android.build.gradle.internal.VariantManager.createTasksForVariantData(VariantManager.java:274)
        at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:216)
        at com.android.build.gradle.internal.VariantManager$createAndroidTasks.call(Unknown Source)
        at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:463)
        at com.android.build.gradle.BasePlugin$_createTasks_closure9.doCall(BasePlugin.groovy:408)
        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)
        ... 31 more
Caused by: java.lang.NoClassDefFoundError: proguard/ParseException
        at org.gradle.api.internal.AbstractClassGenerator.inspectType(AbstractClassGenerator.java:265)
        at org.gradle.api.internal.AbstractClassGenerator.inspectType(AbstractClassGenerator.java:220)
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:98)
        ... 54 more
Caused by: java.lang.ClassNotFoundException: proguard.ParseException
        ... 57 more

共有1个答案

祁乐邦
2023-03-14

如果您使用的是版本0.14.0或更高的gradle插件,则应该在build.gradle文件中用“minifyenabled”替换“runproguard”。

minifyEnabled false意味着构建类型名称不能是main或androidTest(这是由插件强制执行的),并且它们必须彼此唯一。引用错误:(26,0)找不到分级DSL方法:“run proguard()”

如何克服,只需删除.Gradle目录&清理并重新启动工作室,然后再次进行Gradle。

 类似资料:
  • 我正在尝试使用gradle运行Android版本。只要我不缩小,它就可以正常工作。当我启用minify(minifyEnabled true)时,构建总是失败,因为“无法为proguard.gradle.ProGuardTask生成代理类”。 gradle文件中我使用mini fy的部分: 只是需要一些帮助知道去哪里找...谢谢。 完整堆栈跟踪

  • 这是我得到的一个例外。 [proguard]优化...

  • 使用scandir()函数时,我收到以下php警告: Scandir无法打开目录:公共html/page2中不允许操作。php在线3 第2页。php 我想使用这个功能来打印我的根文件夹的文件和子目录,但它不工作。 有人知道怎么修吗?

  • 从TensorArray读取: 使用: 问题: 回溯(最近一次调用last):RLU培训中第130行的文件“\main.py”。train()文件“C:\Users\user\Documents\Projects\rl toolkit\rl_training.py”,第129行,在train self中_rpm,赛尔夫。批量大小,自行确定。梯度步数,记录步数b=self。在call result=

  • 现在,在这个包中还有许多包私有类,这些类不应该被该规则选择。这些类中的一些实际上被混淆了,无论是在它们自己的名称还是它们的成员名称中,这很好。 相反,有一些实现公共接口的类,它们的类名不会被混淆,而我希望它们应该被混淆。为了完整起见,当它们的成员名不是接口的一部分时,它们的成员名会被有效地混淆。 示例: 我想强调的是,是在其他(保留)类中创建的,并且只通过返回给客户端代码。 如果可能的话,我如何也

  • 我正在使用Java NIO,由于某种原因,我无法获得files.isHidden()来返回正确的布尔值。程序只是检查目录是否隐藏,如果隐藏,则使其可见,如果不隐藏,则使其隐藏。这就是我所拥有的: 它继续返回false并隐藏目录,尽管目录被隐藏。下面的代码使用旧的File类和Path类可以很好地工作。