Résolu Impossible de construire le module correctement (soudain)
-
Je reçois une erreur lorsque j’essaie de créer mon fichier mod:
C’est --stacktrace:
Causé par : groovy.lang.MissingMethodException : aucune signature de méthode : org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.whenReady() s’applique aux types d’argument : (SetupUtpTestResultListenerAction) valeurs : [SetupUtpTestResultListenerAction@42343c37]
J’ai exécuté et réussi ces commandes:- gradlew.bat setupDecompWorkspace
- gradlew.bat genIntelliJRuns
version mdk : 1.12.2-14.23.5.2836
Wrongs
Script d’initialisation ligne ‘C:\Users\Administrator\AppData\Local\Temp\ijresolvers1.gradle’ : 339
C:\Users\Administrator\AppData\Local\Temp\ijresolvers1.gradle:
Anglais:
//-- Generated by org.jetbrains.kotlin.idea.gradleJava.testing.KotlinTestTasksResolver // Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. import groovy.xml.MarkupBuilder import org.gradle.api.internal.tasks.testing.TestDescriptorInternal static class KotlinMppTestLogger { static def configureTestEventLogging(def task) { task.beforeSuite { descriptor -> logTestEvent("beforeSuite", descriptor, null, null) } task.afterSuite { descriptor, result -> logTestEvent("afterSuite", descriptor, null, result) } task.beforeTest { descriptor -> logTestEvent("beforeTest", descriptor, null, null) } task.onOutput { descriptor, event -> logTestEvent("onOutput", descriptor, event, null) } task.afterTest { descriptor, result -> logTestEvent("afterTest", descriptor, null, result) } } static def logTestEvent(testEventType, TestDescriptorInternal testDescriptor, testEvent, testResult) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: testEventType) { test(id: testDescriptor.id, parentId: testDescriptor.parent?.id ?: '') { if (testDescriptor) { descriptor(name: testDescriptor.name ?: '', displayName: getName(testDescriptor) ?: '', className: testDescriptor.className ?: '') } if (testEvent) { def message = escapeCdata(testEvent.message) event(destination: testEvent.destination) { xml.mkp.yieldUnescaped("$message") } } if (testResult) { def errorMsg = escapeCdata(testResult.exception?.message ?: '') def stackTrace = escapeCdata(getStackTrace(testResult.exception)) result(resultType: testResult.resultType ?: '', startTime: testResult.startTime, endTime: testResult.endTime) { def exception = testResult.exception if (exception?.message?.trim()) xml.mkp.yieldUnescaped("<errorMsg>$errorMsg</errorMsg>") if (exception) xml.mkp.yieldUnescaped("<stackTrace>$stackTrace</stackTrace>") if ('kotlin.AssertionError'.equals(exception?.class?.name) || exception instanceof AssertionError) { failureType('assertionFailed') return } failureType('error') } } } } writeLog(writer.toString()) } static String escapeCdata(String s) { return "<![CDATA[" + s?.getBytes("UTF-8")?.encodeBase64()?.toString() + "]]>"; } static def wrap(String s) { if(!s) return s; s.replaceAll("\r\n|\n\r|\n|\r","<ijLogEol/>\n") } static def writeLog(s) { println String.format("\n<ijLog>%s</ijLog>", wrap(s)) } static def logTestReportLocation(def report) { if(!report) return def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: 'reportLocation', testReport: report) writeLog(writer.toString()); } static def logConfigurationError(aTitle, aMessage, boolean openSettings) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: 'configurationError', openSettings: openSettings) { title(aTitle) message(aMessage) } writeLog(writer.toString()); } static def getStackTrace(Throwable t) { if(!t) return '' StringWriter sw = new StringWriter() t.printStackTrace(new PrintWriter(sw)) sw.toString() } static def getName(TestDescriptorInternal descriptor) { try { return descriptor.getDisplayName() // available starting from ver. 4.10.3 } catch (Throwable ignore) { return descriptor.getName() } } }
// //-- Generated by org.jetbrains.plugins.gradle.service.project.JavaGradleProjectResolver // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. import groovy.xml.MarkupBuilder import org.gradle.api.tasks.testing.TestDescriptor import org.gradle.api.tasks.testing.TestListener import org.gradle.api.tasks.testing.TestOutputEvent import org.gradle.api.tasks.testing.TestOutputListener import org.gradle.api.tasks.testing.TestResult static class IJTestEventLogger { static def configureTestEventLogging(def task) { task.addTestListener( new TestListener() { @Override void beforeSuite(TestDescriptor descriptor) { logTestEvent("beforeSuite", descriptor, null, null) } @Override void afterSuite(TestDescriptor descriptor, TestResult result) { logTestEvent("afterSuite", descriptor, null, result) } @Override void beforeTest(TestDescriptor descriptor) { logTestEvent("beforeTest", descriptor, null, null) } @Override void afterTest(TestDescriptor descriptor, TestResult result) { logTestEvent("afterTest", descriptor, null, result) } } ) task.addTestOutputListener(new TestOutputListener() { @Override void onOutput(TestDescriptor descriptor, TestOutputEvent event) { logTestEvent("onOutput", descriptor, event, null) } }) } static def logTestEvent(testEventType, TestDescriptor testDescriptor, testEvent, testResult) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: testEventType) { test(id: testDescriptor.id, parentId: testDescriptor.parent?.id ?: '') { if (testDescriptor) { descriptor(name: testDescriptor.name ?: '', displayName: getName(testDescriptor) ?: '', className: testDescriptor.className ?: '') } if (testEvent) { def message = escapeCdata(testEvent.message) event(destination: testEvent.destination) { xml.mkp.yieldUnescaped("$message") } } if (testResult) { def errorMsg = escapeCdata(testResult.exception?.message ?: '') def stackTrace = escapeCdata(getStackTrace(testResult.exception)) result(resultType: testResult.resultType ?: '', startTime: testResult.startTime, endTime: testResult.endTime) { def exception = testResult.exception if (exception?.message?.trim()) xml.mkp.yieldUnescaped("<errorMsg>$errorMsg</errorMsg>") if (exception) xml.mkp.yieldUnescaped("<stackTrace>$stackTrace</stackTrace>") if ('junit.framework.ComparisonFailure'.equals(exception?.class?.name) || 'org.junit.ComparisonFailure'.equals(exception?.class?.name)) { def expected = escapeCdata(exception.fExpected) def actual = escapeCdata(exception.fActual) failureType('comparison') xml.mkp.yieldUnescaped("<expected>$expected</expected>") xml.mkp.yieldUnescaped("<actual>$actual</actual>") return } try { def fileComparisonFailure if ('com.intellij.rt.execution.junit.FileComparisonFailure'.equals(exception?.class?.name)) { fileComparisonFailure = exception } else if ('com.intellij.rt.execution.junit.FileComparisonFailure'.equals(exception?.cause?.class?.name)) { fileComparisonFailure = exception.cause } if (fileComparisonFailure) { def expected = escapeCdata(fileComparisonFailure.expected) def actual = escapeCdata(fileComparisonFailure.actual) def filePath = escapeCdata(fileComparisonFailure.filePath) def actualFilePath if (exception.hasProperty('actualFilePath')) { actualFilePath = escapeCdata(fileComparisonFailure.actualFilePath) } failureType('comparison') xml.mkp.yieldUnescaped("<expected>$expected</expected>") xml.mkp.yieldUnescaped("<actual>$actual</actual>") xml.mkp.yieldUnescaped("<filePath>$filePath</filePath>") if (actualFilePath) xml.mkp.yieldUnescaped("<actualFilePath>$actualFilePath</actualFilePath>") return } } catch (ignore) { } if ('junit.framework.AssertionFailedError'.equals(exception?.class?.name) || exception instanceof AssertionError) { failureType('assertionFailed') return } failureType('error') } } } } writeLog(writer.toString()) } static String escapeCdata(String s) { return "<![CDATA[" + s?.getBytes("UTF-8")?.encodeBase64()?.toString() + "]]>"; } static def wrap(String s) { if(!s) return s; s.replaceAll("\r\n|\n\r|\n|\r","<ijLogEol/>") } static def writeLog(s) { println String.format("<ijLog>%s</ijLog>", wrap(s)) } static def logTestReportLocation(def report) { if(!report) return def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: 'reportLocation', testReport: report) writeLog(writer.toString()); } static def logConfigurationError(aTitle, aMessage, boolean openSettings) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.event(type: 'configurationError', openSettings: openSettings) { title(aTitle) message(aMessage) } writeLog(writer.toString()); } static def getStackTrace(Throwable t) { if(!t) return '' StringWriter sw = new StringWriter() t.printStackTrace(new PrintWriter(sw)) sw.toString() } static def getName(TestDescriptor descriptor) { try { return descriptor.getDisplayName() // available starting from ver. 4.10.3 } catch (Throwable ignore) { return descriptor.getName() } } } // //-- Generated by com.android.tools.utp.GradleAndroidProjectResolverExtension /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.lang.reflect.Proxy /** * An action to attach a listener to DeviceProviderInstrumentTestTasks for communicating * instrumentation test results between AGP and AS. */ static class SetupUtpTestResultListenerAction implements Action<TaskExecutionGraph> { @Override void execute(TaskExecutionGraph taskGraph) { final String ENABLE_UTP_TEST_REPORT_PROPERTY = "com.android.tools.utp.GradleAndroidProjectResolverExtension.enable" final String ON_RESULT_TAG = "UTP_TEST_RESULT_ON_TEST_RESULT_EVENT" taskGraph.allTasks.each { task -> if (!task.project.hasProperty(ENABLE_UTP_TEST_REPORT_PROPERTY) || !task.project.property(ENABLE_UTP_TEST_REPORT_PROPERTY).toString().toBoolean()) { return } Class<?> testTaskClass try { testTaskClass = task.class.classLoader.loadClass( "com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask") } catch (ClassNotFoundException e) { return } if (!testTaskClass.isInstance(task)) { return } Class<?> listenerClass try { listenerClass = task.class.classLoader.loadClass( "com.android.build.gradle.internal.testing.utp.UtpTestResultListener") } catch (ClassNotFoundException e) { // Project's AGP version is too old and UtpTestResultListener is not available. return } def listener = Proxy.newProxyInstance( listenerClass.classLoader, [ listenerClass ] as Class<?>[]) { _, method, args -> switch(method.name) { case "onTestResultEvent": def binaryProto = args[0].class.getMethod("toByteArray").invoke(args[0]) as byte[] def encodedProto = Base64.getEncoder().encodeToString(binaryProto) println("<${ON_RESULT_TAG}>${encodedProto}</${ON_RESULT_TAG}>") break } } def setListenerMethod = testTaskClass.getMethod( "setUtpTestResultListener", listenerClass) setListenerMethod.invoke(task, listener) } } } gradle.taskGraph.whenReady(new SetupUtpTestResultListenerAction())
//
mon fichier (fichier d’exemple):import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import org.apache.logging.log4j.Logger; @Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; public static final String NAME = "Example Mod"; public static final String VERSION = "1.0"; private static Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); } @EventHandler public void init(FMLInitializationEvent event) { // some example code logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } }
Pouvez-vous m’aider
-