I am trying to import an existing project (sample project by apigee) into Android Studio 3.0.1. I get the following error:
Gradle sync failed: No signature of method: org.gradle.internal.classloader.FilteringClassLoader.allowPackage() is applicable for argument types: (java.lang.String) values: [org.apache.tools.zip]
Note: I did change the graddle-wrapper.properties file entry from distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip to distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip as I was facing an earlier error.
The Gradle version in Project Structure is also 4.1.
Here are some excerpts from the logs:
2017-11-21 19:45:01,324 [se-915-b01] INFO - tor.impl.FileEditorManagerImpl - Project opening took 875 ms
2017-11-21 19:45:02,350 [ thread 20] INFO - .project.GradleProjectResolver - Gradle project resolve error
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.1-all.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
....
Caused by: org.gradle.internal.exceptions.LocationAwareException: Build file 'C:\apigee-android-sdk-2.0.14\source\build.gradle' line: 2
A problem occurred evaluating root project 'apigee-android'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:74)
......
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'apigee-android'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
....
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [class 'com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin']
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:150)
....
Caused by: groovy.lang.MissingMethodException: No signature of method: org.gradle.internal.classloader.FilteringClassLoader.allowPackage() is applicable for argument types: (java.lang.String) values: [org.apache.tools.zip]
at com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.apply(ShadowBasePlugin.groovy:36)
......
2017-11-21 19:45:02,361 [ thread 20] WARN - nal.AbstractExternalSystemTask - No signature of method: org.gradle.internal.classloader.FilteringClassLoader.allowPackage() is applicable for argument types: (java.lang.String) values: [org.apache.tools.zip]
com.intellij.openapi.externalSystem.model.LocationAwareExternalSystemException: No signature of method: org.gradle.internal.classloader.FilteringClassLoader.allowPackage() is applicable for argument types: (java.lang.String) values: [org.apache.tools.zip]
at com.android.tools.idea.gradle.project.sync.idea.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:81)
......
Caused by: groovy.lang.MissingMethodException: No signature of method: org.gradle.internal.classloader.FilteringClassLoader.allowPackage() is applicable for argument types: (java.lang.String) values: [org.apache.tools.zip]
at com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.apply(ShadowBasePlugin.groovy:36)
Related
Every time my gradle is syncing it gets errors like this. Can someone help me?
Error cause after adding firebase_ml_vision dependency.
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: java.lang.RuntimeException: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
org.codehaus.groovy.runtime.metaclass.MissingMethodExecutionFailed: No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [C:\Users\37499\AndroidStudioProjects\flutter_ml_demo\build\app\intermediates\flutter\debug]
I tried changing gradle, java and firebase versions but that don't help.
How can I resolve this error, I get this after upgrading my kotlin to 1.6.10
Is there any concrete way resolve this
Caused by: java.lang.IllegalStateException: Could not parse metadata! This should only happen if you're using Kotlin <1.1.
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.readKotlinClassMetadata(KotlinPoetMetadata.kt:83)
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.toImmutableKmClass(KotlinPoetMetadata.kt:113)
at com.squareup.moshi.kotlin.codegen.MoshiCachedClassInspector.toImmutableKmClass(MoshiCachedClassInspector.kt:37)
at com.squareup.moshi.kotlin.codegen.MetadataKt.targetType(metadata.kt:137)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.adapterGenerator(JsonClassCodegenProcessor.kt:148)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.process(JsonClassCodegenProcessor.kt:114)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:188)
I am trying to generate Jacoco XML reports for this Android project. I am using the gradle-android-junit-jacoco-plugin version 0.16.0 (latest as of today).
When I run the jacocoTestReportMerged task it fails with the following error:
Caused by: java.io.IOException: Error while analyzing XmlPullParsers.class.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:170)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:142)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:165)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:201)
at org.jacoco.ant.ReportTask.createBundle(ReportTask.java:570)
at org.jacoco.ant.ReportTask.createReport(ReportTask.java:542)
at org.jacoco.ant.ReportTask.execute(ReportTask.java:495)
... 210 more
Caused by: java.lang.IllegalStateException: Can't add different class with same name:
info/metadude/android/eventfahrplan/network/serialization/XmlPullParsers
at org.jacoco.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:107)
at org.jacoco.core.analysis.Analyzer$1.visitEnd(Analyzer.java:98)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:338)
at org.jacoco.core.internal.flow.ClassProbesAdapter.visitEnd(ClassProbesAdapter.java:98)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:683)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:124)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:140)
... 215 more
I started configuring exclude rules such as ...
junitJacoco {
excludes = [
"**/XmlPullParsers.*"
]
}
... but then the task fails at the next file - so this does not seem to be the correct way.
I also tried 0.17.0-SNAPSHOT and version prior to 0.16.0, without success though. Gradle 6.3 is used in this project.
How can I configure the Gradle plugin for my project?
I'm trying to make an APK of a web app, I wrapped it into Cordova.
I followed various tutorials, installed Gradle and made it work.
When i run cordova build android ---verbose from CMD, I get this error:
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\USER\AppData\Local\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Running command: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug -b C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Command finished with error code 1: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug,-b,C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Error: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
at ChildProcess.whenDone (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:310:20)
at ChildProcess.cp.emit (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
Using Gradle 6.3
I tried a lot of tutorials and StackOverflow solution, but none of them work for me.
My gradle-wrapper.properties
Tue Oct 16 17:39:45 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=C:\Users\USER\Downloads\gradle-6.3-bin.zip
I am using gradle 5.1.1 for cordova9.0.
There is no problems.
My project is using lombok library. I am trying to migrate my project to AndroidX. But its build failed with below exception.
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Failed to transform file 'lombok-1.18.4.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
Failed to transform '/Users/xxx/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.4/7103ab519b1cdbb0642ad4eaf1db209d905d0f96/lombok-1.18.4.jar' using Jetifier. Reason: The type does not support '.' as package separator!. (Run with --stacktrace for more details.) To disable Jetifier, set android.enableJetifier=false in your gradle.properties file.
* Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1013)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1700(DefaultConfiguration.java:123)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:987)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:76)
Caused by: org.gradle.api.artifacts.transform.ArtifactTransformException: Failed to transform file 'lombok-1.18.4.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
at org.gradle.api.internal.artifacts.transform.UserCodeBackedTransformer.transform(UserCodeBackedTransformer.java:89)
at org.gradle.api.internal.artifacts.transform.ChainedTransformer.transform(ChainedTransformer.java:36)
at org.gradle.api.internal.artifacts.transform.TransformArtifactOperation.run(TransformArtifactOperation.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
at org.gradle.api.internal.artifacts.transform.UserCodeBackedTransformer.transform(UserCodeBackedTransformer.java:87)
... 17 more
Caused by: java.lang.IllegalArgumentException: The type does not support '.' as package separator!
at com.android.tools.build.jetifier.core.type.JavaType.<init>(JavaType.kt:28)
at com.android.tools.build.jetifier.processor.transform.bytecode.asm.CustomRemapper.map(CustomRemapper.kt:29)
at org.objectweb.asm.commons.Remapper.mapPackageName(Remapper.java:235)
at org.objectweb.asm.commons.ModuleRemapper.visitExport(ModuleRemapper.java:78)
at org.objectweb.asm.ClassReader.readModule(ClassReader.java:774)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:632)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.android.tools.build.jetifier.processor.transform.bytecode.ByteCodeTransformer.runTransform(ByteCodeTransformer.kt:39)
at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:328)
at com.android.tools.build.jetifier.processor.archive.ArchiveFile.accept(ArchiveFile.kt:41)
at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:316)
at com.android.tools.build.jetifier.processor.archive.Archive.accept(Archive.kt:66)
at com.android.tools.build.jetifier.processor.Processor.transformLibrary(Processor.kt:312)
at com.android.tools.build.jetifier.processor.Processor.transform(Processor.kt:175)
at com.android.build.gradle.internal.dependency.JetifyTransform.transform(JetifyTransform.kt:199)
... 39 more
Here is my gradle.properties file
org.gradle.jvmargs=-Xmx2560M
pgiMixpanelToken="null"
pgiProdApiKey="null"
android.databinding.enableV2=true
android.useAndroidX=true
android.enableJetifier=true
Please help me to resolve this.