snakeyaml-1.27-android.jar not found error while running tests - java

./gradlew test
Task :compileTestJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Could not find snakeyaml-1.27-android.jar (org.yaml:snakeyaml:1.27).
Searched in the following locations:
file:/Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar
I get the above error with the following definition in my build.gradle file, trying to exclude from javafaker doesn't help either. What should I do here?
// faker
testImplementation('com.github.javafaker:javafaker:1.0.2')
testImplementation group: 'org.yaml', name: 'snakeyaml', version: '1.27'

In my case, I just deleted snakeyaml dependencies directory manually (*/.m2/repository/org/yaml/snakeyaml), it works.

// https://mvnrepository.com/artifact/com.github.javafaker/javafaker
implementation 'com.github.javafaker:javafaker:1.0.2'
Result: Could not find snakeyaml-1.30-android.jar (org.yaml:snakeyaml:1.30).
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.30/snakeyaml-1.30-android.jar
Solution: Use dataFaker instead of javaFaker that will resolve all the issues, like so:
// https://mvnrepository.com/artifact/net.datafaker/datafaker
implementation 'net.datafaker:datafaker:1.5.0'

You need to exclude the org.yaml from the java faker dependency.
implementation ('com.github.javafaker:javafaker:1.0.2') { exclude module: 'org.yaml' }
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.26'

Workaround: Copy existing snakeyaml jar to the filename being searched
cp /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar

Related

IntelliJ doesn't generate metamodel classes after configuration (with gradle)

What I did so far:
Enabled annotation processing in idea's preferences and selected Obtain processors from project classpath, then selected Module content root
Added compileOnly group: 'org.hibernate', name: 'hibernate-jpamodelgen', version: '5.6.0.Final' dependency to build.gradle
Built the project
I can see the route build/generated/sources/annotationProcessors/main where main is a generated source route but it's empty and no metamodel classes there.
I can find these simple steps everywhere but unable to create metamodel classes.
What am I missing or doing wrong?
I managed to fix the issue with the following additional dependency: annotationProcessor group: 'org.hibernate', name: 'hibernate-jpamodelgen', version: '5.6.0.Final'
Just for future reference.

Gradle to use a jar-with-dependencies in compile task

We have a project that make use of 'jrs-rest-java-client', version: '6.3.1'
The site we used to get the jar from has a certificate issue since September. https://jaspersoft.artifactoryonline.com
We then had to get the jar from a different site.
https://jaspersoft.jfrog.io/
The problem is that a dependency require is missing, but if we use the jar that has "-jar-with-dependencies" it is working. I tried by downloading that jar locally and changing the .gradle to use the local version.
What I would prefer is to have the build to fetch that version directly without having to download first.
How do we specify what jar to use?
dependencies {
compile fileTree(dir: 'lib',
includes: [
'ojdbc8.jar',
])
//compile group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1'
compile group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', USETHISONE: 'jar-with-dependencies'
//compile files("${buildDir}/jrs-rest-java-client-6.3.1-jar-with-dependencies.jar")
}
I have now tried as suggested;
repositories {
mavenCentral()
// to handle broked jasper reports dependencies
maven {
url 'http://jasperreports.sourceforge.net/maven2'
url 'https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/'
url "https://jaspersoft.jfrog.io/jaspersoft/jaspersoft-clients-releases"
}
}
dependencies {
implementation project(':common:project-common-properties')
implementation project(':common:project-common-mail')
implementation fileTree(dir: 'lib', includes: [
'ojdbc8.jar'
])
implementation group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', classifier: 'jar-with-dependencies'
}
I'm still getting errors at build time...
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':services:notificationService:compileClasspath'.
> Could not find com.jaspersoft.jasperserver:jasperserver-dto:6.3.0.
Required by:
project :services:notificationService > com.jaspersoft:jrs-rest-java-client:6.3.1
That library is not required if the jrs-rest-java-client-6.3.1-jar-with-dependencies.jar is used.
Thanks all,
The solution was, as seen if the video (Thanks!)
adding a new url:
url "https://jaspersoft.jfrog.io/jaspersoft/jrs-ce-releases"
From the jfrog repo, it shows you how to do this:
compile(group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', classifier: 'jar-with-dependencies')
Add the repo for gradle:
repositories {
jcenter {
name "jaspersoft-releases"
url "https://jaspersoft.jfrog.io/jaspersoft/jaspersoft-clients-releases"
}
}
I'd recommend switching from compile to implementation and using a shorthand to declare the dependency:
implementation "com.jaspersoft:jrs-rest-java-client:6.3.1:jar-with-dependencies"
Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for his life time.
I decided to record a short clip of how I found the appropriate repositories for the artifacts you needed, on jfrog:

Error implementing Vimeo-networking

I have tried many different ways of getting Vimeo networking into my app, but nothing has worked. If I remove the implementation it works just fine so I know this is the issue.
compile 'com.vimeo.networking:vimeo-networking:1.1.1'
gives me this error
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I have searched all over and have yet to find a solution (yes I have tried cleaning and rebuilding the project)
SOLUTION: anthonycr's answer was perfect, but I also had to do this:
implementation ("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version") {
exclude group: 'org.jetbrains', module: 'annotations'
}
implementation ('com.vimeo.networking:vimeo-networking:1.1.1') {
exclude group: 'org.jetbrains', module: 'annotations'
}
I believe this is the result of the vimeo-networking library including a dependency which you are also separately including in your gradle file. Looking at the gradle file for a hint, a prime suspect is the intellij annotations jar 'com.intellij:annotations:12.0#jar' dependency, which I have seen cause similar problems when also included in your main project as well as a sub-projects.
The solution to this is to exclude the annotations jar when compiling in the vimeo-networking library as follows:
compile ('com.vimeo.networking:vimeo-networking:1.1.1') {
exclude group: 'org.jetbrains', module: 'annotations'
}
Try this and see if it fixes your build exception. Generally I've seen that the cause for the Unable to merge dex error is that there are multiple definitions of the same class in the final dex file, usually resulting from the inclusion of a jar file multiple times.

How to solve A library uses the same package as this project?

How do I fix this?
Error:Execution failed for task ':androidmapsutils:processReleaseResources'.
> Error: A library uses the same package as this project: com.google.maps.android
If you use enforceUniquePackageName=false you'll eventually stumble upon this bug -
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: ... BuildConfig.class
and in order to fix that you'll have to check if some of your dependencies have multidex as a dependency in it and exclude it, for example the Facebook SDK -
compile('com.facebook.android:facebook-android-sdk:+') {
exclude group: 'com.android.support', module: 'multidex'
}
You can refer to this Stack Overflow and this Issue Tracker
compile project(path: ':backend', configuration: 'android-endpoints')
compile project(':library')
Check included package name
com.google.maps.android.

Failed resolution of: Lorg/apache/commons/codec/digest/DigestUtils

I am having issues with app crashing and giving this stack trace
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/codec/digest/DigestUtils;
at com.ryko.fstwo.wrapper.DigestUtilsWrapper.sha1(DigestUtilsWrapper.java:7)
...
Didn't find class "org.apache.commons.codec.digest.DigestUtils" on path: <really long path name>
I have gone through all the threads on here I can find about this problem, but cant find a resolution. In my libs folder I have commons-collections-3.2.1.jar, In my dependencies section on build.gradle I have
compile 'org.apache.commons:commons-collections4:4.1' and
compile files('libs/commons-collections-3.2.1.jar').
I have read through these but can't find a working solution
1, 2, 3 and many others
I guess that you need a dependency to commons-codec. It is available in maven central repo.
For example, add this to the dependencies section of your build.gradle:
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
Or you you prefer the shorter option:
compile group: 'commons-codec:commons-codec:1.10'
you need have changes,such as
dependencies {
implementation 'commons-codec:commons-codec:1.10'
}

Categories