When i tried to build, ide throw error: "Unresolved reference: X "
X is any Java constant (public static final) on (public) class Java
Can’t use:
android.os.Environment.DIRECTORY_DOCUMENTS
Build.VERSION_CODES.M
Etc
I have tried:
Invalidate Cache in Android Studio
gradlew cleanBuildCache
Clean / Rebuild
Clone project on other folder,
Etc
It’s a mixed project, Java & Kotlin
I can use static methods, like:
public static Uri getUriForFile from public class FileProvider
Etc
Error line:
10:38:23.053 [ERROR] [org.gradle.api.Task] e: C:\Users\User\AndroidStudioProjects\MyAndroidProject\app\src\main\kotlin\com\myapp\mypackage\android\PermissionsHelper.kt: (67, 66): Unresolved reference: M
I’m using:
Gradle Configuration
ext.kotlin_version = ‘1.3.10’
classpath ‘com.android.tools.build:gradle:3.2.1’
androidExtensions { experimental = true }
Software
Windows 10 Pro 10.0.17134 N/D Compilation 17134 x64
Android Studio 3.2.1 Build #Al-181-5540.7.32.5056338,build on Octubre 8, 2018
java version “1.8.0_162”
Java™ SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot™ 64-Bit Server VM (build 25.162-b12, mixed mode)
Stacktrace:
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:compileDebugKotlin'.
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Compilation error. See log for more details
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --scan to get full insights.
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:38:23.076 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugKotlin'.
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipCachedTaskExecuter.execute(SkipCachedTaskExecuter.java:103)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:66)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
10:38:23.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter
Thank you #yole and #Rod_Algonquin for the help, meanwhile i was writing the questions, and answering the questions, the Rubber duck method help me, the IDE was throwing me a error "Unresolved reference", but the problem was the annotation:
#RequiresApi(Build.VERSION_CODES.M)
Because: minSdkVersion 16
I was working on PermissionsHelper.kt, I was using Activity instead of android.support.v4.app.Fragment or ContextCompat for old versions.
Sorry guys for not post the code, and the complete gradle, i wanted to do a short post, this is my fist post.
Thank yo for all the help.
Related
how to proguard with intellij idea gradle intellij-plugin?
use the code can not work for me !
config build.gradle
def ideaPath = "D:/java/ideaIU-2022.1.3.win"
task proguard(type: ProGuardTask) {
// dependsOn intelli
verbose
// injars "${buildDir}/libs/xxx-1.4.8.jar"
injars "${buildDir}/classes/java/main"
outjars "${buildDir}/libs/xxx-1.4.8-obfuscatedClasses.jar"
// Automatically handle the Java version of this build.
if (System.getProperty('java.version').startsWith('1.')) {
// Before Java 9, the runtime classes were packaged in a single jar file.
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
} else {
// As of Java 9, the runtime classes are packaged in modular jmod files.
libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/java.sql.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/java.desktop.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
//libraryjars "${System.getProperty('java.home')}/jmods/....."
}
// This will contain the Spring dependencies.
libraryjars sourceSets.main.compileClasspath
// libraryjars fileTree("$ideaPath/plugins/java/lib").filter { !it.name.startsWith("debugger") }.collect()
// libraryjars files("$ideaPath/lib")
dontnote 'kotlin.**'
dontnote 'kotlinx.**'
dontnote 'org.intellij.**'
dontnote 'com.intellij.**'
dontnote 'com.google.gson.**'
dontnote 'proguard.configuration.ConfigurationLogger'
dontobfuscate
optimizationpasses 10
keepclasseswithmembers 'public class * { \
public static void main(java.lang.String[]); \
}'
// Keep the main class entry point.
keep 'public class com.example.demo.DemoApplication { \
public static void main(java.lang.String[]); \
}'
keepattributes '*Annotation*'
// This simple example requires classes with #Component annotation classes
// to be kept, since otherwise components could end up with clashing names,
// if they do not set the name explicitly.
keep 'public #org.springframework.stereotype.Component class *'
// You may need to keep classes or members based on other annotations such as:
keepclassmembers 'public class * { \
#org.springframework.beans.factory.annotation.Autowired *; \
#org.springframework.beans.factory.annotation.Value *; \
}'
// After ProGuard has executed, repackage the app.
// finalizedBy tasks.repackage
}
Are there any examples that can be executed?
My idea Version: ideaIU-2022.1.3.win
Java Version:
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment JBR-11.0.15.10-2043.56-jcef (build 11.0.15+10-b2043.56)
OpenJDK 64-Bit Server VM JBR-11.0.15.10-2043.56-jcef (build 11.0.15+10-b2043.56, mixed mode)
Gralde Version: gradle-7.5.1
the error message:
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':proguard'.
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.io.IOException: Please correct the above warnings first.
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --stacktrace option to get the stack trace.
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
2022-08-10T11:20:00.704+0800 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 10s
11:20:00: 'proguard --debug'。
Thks!
I am not an android dev i know web dev and somewhat of android studio so i got an external dev to build an app for me which i just compile in android studio and ship the apk/obb to google play all was fine in Nov but in December i made a little edit in ui but when i tried to "Make project" the build failed giving this error.
From what i read bintray is no longer used but this dev uses it can anyone help understand this error and how to fix it.
the error:
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not determine the dependencies of task ':app:dataBindingMergeDependencyArtifactsDebug'.
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.venmo.view.tooltip:tooltip:0.1.2.
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.venmo.view.tooltip:tooltip:0.1.2.
2021-12-16T00:30:13.125+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/venmo/view/tooltip/tooltip/0.1.2/tooltip-0.1.2.pom'.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/venmo/view/tooltip/tooltip/0.1.2/tooltip-0.1.2.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.faltenreich:skeletonlayout:2.0.1.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.faltenreich:skeletonlayout:2.0.1.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/faltenreich/skeletonlayout/2.0.1/skeletonlayout-2.0.1.pom'.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/faltenreich/skeletonlayout/2.0.1/skeletonlayout-2.0.1.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.facebook.shimmer:shimmer:0.5.0.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.facebook.shimmer:shimmer:0.5.0.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/facebook/shimmer/shimmer/0.5.0/shimmer-0.5.0.pom'.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/facebook/shimmer/shimmer/0.5.0/shimmer-0.5.0.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.zendesk.belvedere2:belvedere:3.0.0-RC.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.zendesk.belvedere2:belvedere:3.0.0-RC.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/zendesk/belvedere2/belvedere/3.0.0-RC/belvedere-3.0.0-RC.pom'.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/zendesk/belvedere2/belvedere/3.0.0-RC/belvedere-3.0.0-RC.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.yarolegovich:discrete-scrollview:1.5.1.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.yarolegovich:discrete-scrollview:1.5.1.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/yarolegovich/discrete-scrollview/1.5.1/discrete-scrollview-1.5.1.pom'.
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/yarolegovich/discrete-scrollview/1.5.1/discrete-scrollview-1.5.1.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.126+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.facebook.android:facebook-android-sdk:7.0.0.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.facebook.android:facebook-android-sdk:7.0.0.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/facebook/android/facebook-android-sdk/7.0.0/facebook-android-sdk-7.0.0.pom'.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/facebook/android/facebook-android-sdk/7.0.0/facebook-android-sdk-7.0.0.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.shobhitpuri.custombuttons:google-signin:1.0.0.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.shobhitpuri.custombuttons:google-signin:1.0.0.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/shobhitpuri/custombuttons/google-signin/1.0.0/google-signin-1.0.0.pom'.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not HEAD 'http://dl.bintray.com/jlmd/maven/com/shobhitpuri/custombuttons/google-signin/1.0.0/google-signin-1.0.0.pom'. Received status code 502 from server: Bad Gateway
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.squareup.picasso:picasso:2.71828.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by:
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project :app
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve com.squareup.picasso:picasso:2.71828.
2021-12-16T00:30:13.127+0630 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'http://dl.bintray.com/jlmd/maven/com/squareup/picasso/picasso/2.71828/picasso-2.71828.pom'.
More go on like this but its too long to show here
This is the gradle script
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.21'
repositories {
jcenter()
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.10'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
// id "org.jetbrains.kotlin.jvm" version '1.4.21'
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/jlmd/maven" }
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
maven {
url 'https://zendesk.jfrog.io/zendesk/oss-releases-local'
}
jcenter()
google()
mavenCentral()
jcenter()
}
}
repositories {
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
apply plugin: "org.jetbrains.kotlin.jvm"
Please help we are 6 days late on our update and i just need someone to help me. fi this post is wrong or need to fix something please tell me and i will fix it.
I am migrating my project to Java 15 version. We have done all the required changes and started building a maven clean install.
I am getting the below error. Tried many from google and Github other forums, nothing working.
TestNG version changes, and some plugin changes, but no luck.
Please find below the error. Can someone help...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project quarterback: There are test failures.
[ERROR]
[ERROR] Please refer to surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com....ABCTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...DEFTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...GHITest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...JKLTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...MNOTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...ABCTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:532)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:405)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:321)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com....DEFTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$700(ForkStarter.java:121)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:393)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:370)
[ERROR] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:832)
The thing that you see the stacktrace does not necessarily mean an error in the plugin.
I think the log with Cannot instantiate class com...ABCTest is printed by your framework, TestNG. Is the TestNG reliable in JDK 15?
You can see more in the dump files with detailed errors located in target/surefire-reports.
I found similar issue in https://sqa.stackexchange.com/questions/14680/cannot-instantiate-class-error-selenium-webdriver and the root cause looks like they called the driver
driver.findElement(...)
in the constructor of the test class.
I had a very similar problem with surefire and testng and it turned out that there was an error in the constructor of the test class that had been swallowed. My solution was to surround the whole costuctor code with try/catch and log the exception manually to find the real issue.
I've got a Maven project for a java application. The software versions I'm using are following:
Maven 3.6.3, Java 1.8.0_241.
I've got few junit tests within this Maven project, that I'm trying to run using the Maven "mvn" command. When I run the command "mvn clean test" on my Maven project to run my unit tests, I get below mentioned build failure.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:48 min
[INFO] Finished at: 2020-02-21T09:37:00+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project Myproject-restapis: There are test failures.
[ERROR]
[ERROR] Please refer to F:\eclipseWorkspaces\my_project\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "C:\jdk1.8.0_241\jre\bin\java -jar C:\Users\mukul\AppData\Local\Temp\surefire4895736141834565700\surefirebooter185004090178601900.jar C:\Users\mukul\AppData\Local\Temp\surefire4895736141834565700 2020-02-21T09-34-41_267-jvmRun1 surefire413243705282645614tmp surefire_01613681214173913161tmp"
[ERROR] Process Exit Code: 0
[ERROR] Crashed tests:
[ERROR] com.example.test.SampleTest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "C:\jdk1.8.0_241\jre\bin\java -jar C:\Users\mukul\AppData\Local\Temp\surefire4895736141834565700\surefirebooter185004090178601900.jar C:\Users\mukul\AppData\Local\Temp\surefire4895736141834565700 2020-02-21T09-34-41_267-jvmRun1 surefire413243705282645614tmp surefire_01613681214173913161tmp"
[ERROR] Process Exit Code: 0
[ERROR] Crashed tests:
[ERROR] com.example.test.SampleTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
I've looked a lot on web about the above mentioned issue, but haven't been able to solve this for few days now.
The command 'mvn clean install -DskipTests' runs fine for me, and I get build success.
Can anyone please try to provide solution for the above mentioned issue, with the Maven command 'mvn clean test'.
Well, I had the exactly same issue, and the way that I sorted it out was to configure log properly for my tests..
I have a multi-module project, and I added a logback-test.xml in the root my my parent project and pointed my maven-surefire-plugin to load this file. See the config bellow:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dlogback.configurationFile=${project.basedir}/../logback-test.xml</argLine>
</configuration>
</plugin>
In the logbook-test.xml I reduced a lot of the logs and added some library packages to print from WARN level.
<logger name="org.apache.solr" level="WARN" />
Important: Make sure you replace all System.out.println with log.debug
I am new to android studio and building my app but it say build failed with one error plz help
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file 'C:\Users\user\AndroidStudioProjects\Happybirthday1\build.gradle' line: 32
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not compile build file 'C:\Users\user\AndroidStudioProjects\Happybirthday1\build.gradle'.
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > startup failed:
13:25:49.885 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] build file 'C:\Users\user\AndroidStudioProjects\Happybirthday1\build.gradle': 32: expecting '}', found '' # line 32, column 1.
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 1 error
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
13:25:49.900 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 1s
I believe you just missed a '}' in build.gradle file. Should be quite straightforward to fix.
Missed "}" in the code
build file 'C:\Users\user\AndroidStudioProjects\Happybirthday1\build.gradle': 32: expecting '}', found '' # line 32, column 1.