how to proguard with intellij idea gradle intellij-plugin - java

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!

Related

Bintray? issue build failed

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.

Import error even though dependencies exist

When I add import org.springframework.data.annotation.Id; to my Java file I get this error:
The import org.springframework.data cannot be resolved
My immediate thought is that I'm missing a dependency but I don't think this is the case.
Here's the dependencies from my build.gradle.
dependencies {
compile('org.springframework.boot:spring-boot-starter-webflux')
compile('org.synchronoss.cloud:nio-multipart-parser')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive')
compile('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('io.projectreactor:reactor-test')
}
Also, I've applied these plugins:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
Am I missing something, or how do I get past this issue?
Additional Info.
I ran ./gradlew clean build --refresh-dependencies --debug. Here is an extract from the log:
22:25:30.664 [ERROR] [system.err] /Users/me/git/learning-spring-boot/learning-spring-boot-ch2/src/main/java/com/greglturnquist/learningspringboot/learningspringboot/ImageService.java:40: error: constructor Image in class Image cannot be applied to given types;
22:25:30.664 [ERROR] [system.err] new Image(path.hashCode(),
22:25:30.664 [ERROR] [system.err] ^
22:25:30.664 [ERROR] [system.err] required: String
22:25:30.665 [ERROR] [system.err] found: int,String
22:25:30.665 [ERROR] [system.err] reason: actual and formal argument lists differ in length
22:25:30.698 [ERROR] [system.err] /Users/me/git/learning-spring-boot/learning-spring-boot-ch2/src/main/java/com/greglturnquist/learningspringboot/learningspringboot/ApiController.java:26: error: constructor Image in class Image cannot be applied to given types;
22:25:30.700 [ERROR] [system.err] new Image("1", "learning-spring-boot-cover.jpg"),
22:25:30.700 [ERROR] [system.err] ^
22:25:30.700 [ERROR] [system.err] required: String
22:25:30.700 [ERROR] [system.err] found: String,String
22:25:30.701 [ERROR] [system.err] reason: actual and formal argument lists differ in length
22:25:30.701 [ERROR] [system.err] /Users/me/git/learning-spring-boot/learning-spring-boot-ch2/src/main/java/com/greglturnquist/learningspringboot/learningspringboot/ApiController.java:27: error: constructor Image in class Image cannot be applied to given types;
22:25:30.701 [ERROR] [system.err] new Image("2", "learning-spring-boot-2nd-edition-cover.jpg"),
22:25:30.702 [ERROR] [system.err] ^
22:25:30.702 [ERROR] [system.err] required: String
22:25:30.702 [ERROR] [system.err] found: String,String
22:25:30.702 [ERROR] [system.err] reason: actual and formal argument lists differ in length
22:25:30.705 [ERROR] [system.err] /Users/me/git/learning-spring-boot/learning-spring-boot-ch2/src/main/java/com/greglturnquist/learningspringboot/learningspringboot/ApiController.java:28: error: constructor Image in class Image cannot be applied to given types;
22:25:30.706 [ERROR] [system.err] new Image("3", "bazinga.png")
22:25:30.706 [ERROR] [system.err] ^
22:25:30.706 [ERROR] [system.err] required: String
22:25:30.706 [ERROR] [system.err] found: String,String
22:25:30.707 [ERROR] [system.err] reason: actual and formal argument lists differ in length
22:25:30.713 [ERROR] [system.err] 4 errors
22:25:30.716 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute compile for :compileJava'
22:25:30.726 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute compile for :compileJava' completed
22:25:30.733 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Fingerprinting property destinationDir (Output) for task ':compileJava'
22:25:30.737 [LIFECYCLE] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache]
22:25:30.737 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache fileHashes.bin (/Users/me/git/learning-spring-boot/learning-spring-boot-ch2/.gradle/4.10.2/fileHashes/fileHashes.bin)
22:25:30.702 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger]
22:25:30.702 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :compileJava FAILED
22:25:30.738 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
22:25:30.739 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileJava'
22:25:30.740 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Task :compileJava'
22:25:30.740 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :compileJava' completed
22:25:30.741 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :compileJava (Thread[Task worker for ':',5,main]) completed. Took 59.344 secs.
22:25:30.741 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':': released lock on :
22:25:30.742 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.13 completed (1 worker(s) in use)
22:25:30.743 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':': released lock on root.1.13
22:25:30.743 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 7,5,main]] finished, busy: 0.0 secs, idle: 59.358 secs
22:25:30.744 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':',5,main]] finished, busy: 59.353 secs, idle: 0.006 secs
22:25:30.743 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 3,5,main]] finished, busy: 0.0 secs, idle: 59.358 secs
22:25:30.743 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 2,5,main]] finished, busy: 0.0 secs, idle: 59.36 secs
22:25:30.748 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskExecutionGraph] Timing: Executing the DAG took 59.365 secs
22:25:30.748 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'
22:25:30.748 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Run tasks' completed
22:25:30.749 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':compileJava'.
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Compilation failed; see the compiler error output for details.
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
22:25:30.750 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
22:25:30.751 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. Run with --scan to get full insights.
22:25:30.751 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
22:25:30.751 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
22:25:30.751 [WARN] [org.gradle.internal.featurelifecycle.LoggingDeprecatedFeatureHandler]
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
22:25:30.751 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
22:25:30.751 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 1m 47s
I checked ./gradlew dependencies org.springframework.boot:spring-boot-starter-data-mongodb-reactive -> 2.2.0.BUILD-SNAPSHOT contains org.springframework.data:spring-data-mongodb:2.1.4.BUILD-SNAPSHOT which contains org.springframework:spring-context:5.1.3.RELEASE -> 5.1.4.BUILD-SNAPSHOT. Is it possible org.springframework:spring-context:5.1.3.RELEASE -> 5.1.4.BUILD-SNAPSHOT is not a compatible version?
This class org.springframework.data.annotation.Id belongs to the Spring module org.springframework.data:spring-data-commons. So if you want to import classes from this module you should add a dependency to it:
dependencies{
compile("org.springframework.data:spring-data-commons")
// others ...
}
Note you should also be able to import this class without this explicit dependency to spring-data-commons module, since this module is already part of the transitive dependencies of your project (from spring-boot-starter-data-mongodb-reactive). This means that with your current build.gradle setup, you should be able to import this class without error.
./gradlew dependencies
+--- org.springframework.boot:spring-boot-starter-data-mongodb-reactive -> 2.0.0.RELEASE
| +--- org.springframework.boot:spring-boot-starter:2.0.0.RELEASE (*)
| +--- org.springframework.data:spring-data-mongodb:2.0.5.RELEASE
| | +--- org.springframework:spring-tx:5.0.4.RELEASE
| | | +--- org.springframework:spring-beans:5.0.4.RELEASE (*)
| | | \--- org.springframework:spring-core:5.0.4.RELEASE (*)
| | +--- org.springframework:spring-context:5.0.4.RELEASE (*)
| | +--- org.springframework:spring-beans:5.0.4.RELEASE (*)
| | +--- org.springframework:spring-core:5.0.4.RELEASE (*)
| | +--- org.springframework:spring-expression:5.0.4.RELEASE (*)
| | +--- org.springframework.data:spring-data-commons:2.0.5.RELEASE (*)
| | \--- org.slf4j:slf4j-api:1.7.25
So maybe you have a synch issue in your project, try to clean/close/reopen it.
Are you sure that data is part of the imported packages? It seems to me that you need to add org.springframework.data to your gradle file. You can see here that data is different package.

Unresolved Reference when use Java Constants

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.

Building my app but it say build failed with one error

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.

Add groovy script to run through gradle android

I want to run some groovy scripts before gradle builds debug apk in Android.
task batchTask(type: JavaExec) {
description 'running tasks'
exec {
commandLine './Batch.groovy'
}
}
added this to build.gradle(app)
apply plugin: 'groovyx.grooid.groovy-android'
android{
...
dependsOn {
batchTask
}
}
dependencies {
...
compile 'org.codehaus.groovy:groovy:2.4.0:grooid'
}
added this to build.grade(android)
dependencies {
...
classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'
}
I keep getting the error Error:Cause: error=13, Permission denied
stack trace
15:24:22.688 [DEBUG] [org.gradle.process.internal.DefaultExecHandle]
Changing state to: STARTING 15:24:22.689 [DEBUG]
[org.gradle.process.internal.DefaultExecHandle] Waiting until process
started: command './Batch.groovy'. 15:24:22.693 [DEBUG]
[org.gradle.process.internal.DefaultExecHandle] Changing state to:
FAILED 15:24:22.693 [DEBUG]
[org.gradle.process.internal.DefaultExecHandle] Process 'command
'./Batch.groovy'' finished with exit value -1 (state: FAILED)
15:24:22.695 [DEBUG]
[org.gradle.configuration.project.BuildScriptProcessor] Timing:
Running the build script took 1.866 secs 15:24:22.798 [ERROR]
[org.gradle.BuildExceptionReporter] 15:24:22.799 [ERROR]
[org.gradle.BuildExceptionReporter] FAILURE: Build failed with an
exception. 15:24:22.799 [ERROR] [org.gradle.BuildExceptionReporter]
15:24:22.800 [ERROR] [org.gradle.BuildExceptionReporter] * What went
wrong: 15:24:22.800 [ERROR] [org.gradle.BuildExceptionReporter] A
problem occurred evaluating project ':app'. 15:24:22.800 [ERROR]
[org.gradle.BuildExceptionReporter] > A problem occurred starting
process 'command './Batch.groovy'' 15:24:22.801 [ERROR]
[org.gradle.BuildExceptionReporter] 15:24:22.801 [ERROR]
[org.gradle.BuildExceptionReporter] * Try: 15:24:22.801 [ERROR]
[org.gradle.BuildExceptionReporter] Run with --stacktrace option to
get the stack trace. 15:24:22.802 [LIFECYCLE]
[org.gradle.BuildResultLogger] 15:24:22.802 [LIFECYCLE]
[org.gradle.BuildResultLogger] BUILD FAILED
Update:
Running the task inside a Groovy shell did the trick.
task batchTask(type: JavaExec) {
description 'batchTask in progress'
new GroovyShell().run(file('Batch.groovy'))
}
Running the task inside a Groovy shell did the trick.
task batchTask(type: JavaExec) {
description 'batchTask in progress'
new GroovyShell().run(file('Batch.groovy'))
}

Categories