Tring to integrate with JIB (Containerize your Gradle Java project) with my Java project.
Following this documentation: https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin
Added the following to my project:
dependencies {
classpath("gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.1.4")
}
apply plugin: 'com.google.cloud.tools.jib'
jib.to.image = 'my-docker-local/my-app'
Gradle version is: 5.6.4
The compilation with "./gradlew" build is working fine. but, when
excecuting "gradle jib" getting the following error:
gradle jib To honour the JVM settings for this build a single-use
Daemon process will be forked. See
https://docs.gradle.org/7.2/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
FAILURE: Build failed with an exception.
Where: Build file '/Users/igorgumush/dev/java11/my-service/build.gradle' line: 139
What went wrong: A problem occurred evaluating root project 'my-service'.
Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-web,
build_9nl2gys0kuhc8m4mdlq51u41r$_run_closure4$_closure24#6ea6088b] on
object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 8.0.
Well the solution was very simple.
I used:
./gradlew jib
instead of
grade jib
Related
The application which I am working on is debugging fine in emulator or in mobiles but when I try to build the apk it gives the following Error:
Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':image_picker_android:debugUnitTestRuntimeClasspath'.
> Failed to transform bcprov-jdk15on-1.68.jar (org.bouncycastle:bcprov-jdk15on:1.68) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /home/cicada/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar.
> Failed to transform '/home/cicada/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19s
Running Gradle task 'assembleRelease'... 20.7s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
This was my solution which I recommend to be the 2nd option:
Solution 1:
I added following lines in the android directory of app level build.gradle i.e android/app/build.gradle of my project.
lintOptions {
disable 'InvalidPackage'
disable "Instantiatable"
checkReleaseBuilds false
abortOnError false
}
And every thing started to work fine.
Check out my Gradle File
Solution 2:
However I suggest you people by the solution of #Vinadon and agree with the comment of #raiderOne:
1st recommended solution should be:
The issues lies in image_picker_android being updated to gradle 7.1.2. See their changelog. Following an issue on GitHub you have to update your gradle version like so:
In android/gradle/wrapper/gradle-wrapper.properties update your distributionUrl to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
and in android/build.gradle change the gradle version to at least 7.1.2
classpath 'com.android.tools.build:gradle:7.1.2
In #Vinadon case, He had to update his Android Studio for a newer Java version too.
Upvote Vindadon answer below for this solution. Thanks!
The issues lies in image_picker_android being updated to gradle 7.1.2. See their changelog. Following an issue on GitHub you have to update your gradle version like so:
In android/gradle/wrapper/gradle-wrapper.properties update your distributionUrl to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
and in android/build.gradle change the gradle version to at least 7.1.2
classpath 'com.android.tools.build:gradle:7.1.2
In my case, I had to update my Android Studio for a newer Java version too.
Let me help you a little bit in finding the correct place to paste the code
1: Go to your app-level build.grade.
2:Scroll down to "android{ "
paste this code carefully(not disturbing any other brakets.)
lintOptions {
disable 'InvalidPackage'
disable "Instantiatable"
checkReleaseBuilds false
abortOnError false
}
3:run "flutter clean"
4:run "flutter pub get"
5:If you want to build apk of your project then run "flutter build apk"
I hope it works for you.
The solution is actual on 06.06.2022. Adding these lines in pubspec.yaml fixed the problem:
dependency_overrides:
image_picker_android: 0.8.4+13
if you are using flutter 3.0 and image_picker, try this:
dependency_overrides:
image_picker_android: 0.8.4+13
This issue is usually because the gradle plugin is outdated. If your project was created using an older version of flutter the gradle plugin will be old. The actual fix to this issue would be to upgrade the gradle plugin version.
Refer to this issue
You can use android studio to do this for you or just edit the files on your own.
if you are using flutter 3.3 and image_picker, try this:
dependency_overrides:
image_picker_android: 0.8.5+3
I had the same issue, I fixed that by adding the line android.jetifier.blacklist=org.robolectric.*,bcprov in gradle.properties
This is the error message I got,
I've added travis-ci to my github project. Project itself is multi-moduled and consists of :client, :server and :shared.
In the build.gradle of :client module I have organised sourceSets as follows:
sourceSets {
main {
java {
runtimeClasspath += project(":shared").sourceSets.main.java.srcDirs
srcDirs += project(":shared").sourceSets.main.java.srcDirs
}
}
}
Now, when travis-ci runs gradle check it fails with following:
$ gradle server:clean server:check
FAILURE: Build failed with an exception.
* Where:
Build file '/home/travis/build/bduisenov/mockserver/client/build.gradle' line: 55
* What went wrong:
A problem occurred evaluating project ':client'.
> Could not find method main() for arguments [build_ab0sue8nexlysud7wfupu5ddr$_run_closure4_closure12#3fb9a67f] on project ':client'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 10.05 secs
The command "gradle server:clean server:check" exited with 1.
Although running locally, I have no issue with it.
Any thoughts on that?
I think that the error simply comes from the gradle version on Travis CI using an old version 2.0. If you generate your gradle wrapper first then Travis CI will use that instead of the built in version - See https://docs.travis-ci.com/user/languages/java#Projects-Using-Gradle. I did try your project locally and there is no problem on Gradle 2.12.
I have a gradle project in big-project/ and a sub-project in big-project/lib/.
In big-project/'s big.project.Main class I import big.project.lib.Utils, which is defined in the big-project/lib/ sub-project.
When I try to run gradle build, this is what happens:
:lib:
compileJava UP-TO-DATE
:lib:processResources UP-TO-DATE
:lib:classes UP-TO-DATE
:lib:jar
:compileJava
big-project/src/main/java/big/project/Main.java:3: error: package big.project.lib not exist
import big.project.lib.Utils;
^
1 error
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.243 secs
For some reason, gradle compiles the code of the subproject, and then decides to ignore it. How do I fix that?
These are my gradle files:
big-project/settings.gradle:
include 'lib'
big-project/build.gradle:
evaluationDependsOnChildren()
allprojects {
apply plugin: 'java'
sourceCompatibility = '1.8'
version = '1.0'
group = 'big.project'
}
apply plugin: 'war'
dependencies {
compile project(':lib')
}
big-project/lib/build.gradle is empty
I did study the gradle manual: Chapter 56. Multi-project Builds, but nothing useful came from this.
TL;DR: My big-project/lib/src folder wasn't set up correctly (source code was in the wrong sub directory). As this answer states, Java sources need to be in src/main/java.
Thanks to comments on the question I was able to look in the right place for a solution. As suggested, I looked at a working sample project. As I was using Eclipse, I generated a new Gradle project based on the flat-java-multiproject sample. This enabled me to eliminate my build.gradle files as the source of the error.
Next, I decided to inspect the build/ artifacts of the lib/ project and discovered that the .jar file did not contain any .class files. That explains the compiler error I reported in the question. This caused my to see if all .java sources were in the right place, and as mentioned above, they weren't. Fixing this, fixed the compiler error.
The whole crux was that while I was writing my code in eclipse, all references to the lib project's classes seemed to be found.
I try to generate my IPA with $ gradlew ios:generateIPA from commandline but I receive this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ios:createIPA'.
> No #Marshaler found for parameter 3 of #Callback method<org.robovm.apple.uikit.UIApplication: long $cb$beginBackgroundTaskWithExpirationHandler$(org.robovm.apple.uikit.UIApplication,org.robov m.objc.Selector,java.lang.Runnable)>
I have unpacked the lastest robovm release under Downloads, and I also updated robovm eclipse plugin. All to 0.0.11.
My build.gradle is configurated with roboVMVersion = "0.0.11".
What could be the problem?
Thanks!
SOLVED!
It's necessary to create a new App ID from member center, if I want to generate a IPA of my game.
I am getting the following error when I try to build sliding menu project. This project was used in eclipse but I used default import in android studio to get this project.
:slidingMenu:lint FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':slidingMenu:lint'.
[Ljava/util/HashMap$Entry;
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.59 secs Could not execute build using Gradle
distribution
'http://services.gradle.org/distributions/gradle-1.9-all.zip'.
Running with --stacktrace didn't give any new info.
I've tried adding an ignore as mentioned in this answer - gradle build fails on lint task but that doesn't help.
Did the import create a build.gradle in slidingmenu? That might be the problem if it is not defined as a library:
apply plugin: 'android-library'
I don't have it set up as a library in this way though. I include it in the app's build.gradle:
dependencies {
// ...
compile project(':slidingmenu:library')
}
and in settings.gradle:
include ':slidingmenu:library'