0

My project is in Java on android studio on IntelliJ.

I downloaded openbeans-1.0.jar, put it in my libs folder, went to Project Structure, and added it to the dependencies. Here is my build.gradle (:app) code:

apply plugin: 'com.android.application'

apply plugin: 'com.android.application'
android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.gotimejavaversion"
        minSdkVersion 15
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.opencsv:opencsv:5.2'
    implementation 'com.googlecode:openbeans:1.0'
    implementation 'com.univocity:univocity-parsers:2.9.0'
}

This is the MVN Repository info I found online for OpenBeans using gradle(this is just a visual reference I am using to create the line implementation 'com.googlecode:openbeans:1.0' in my build.gradle file. I am not using Maven):

// https://mvnrepository.com/artifact/com.googlecode/openbeans
compile group: 'com.googlecode', name: 'openbeans', version: '1.0'

I get the error:

Could not determine the dependencies of task ':app:compileDebugRenderscript'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.googlecode:openbeans:1.0.
     Required by:
         project :app

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

I couldn't make out what I am doing wrong in the documentation. I've checked how I've typed it in multiple times and have tried implementation 'com.googlecode.openbeans:openbeans:1.0' I'm new to working with repositories and programming at that. Any help is appreciated.

Thank you!

  • "I downloaded openbeans-1.0.jar, put it in my libs folder, went to Project Structure, and added it to the dependencies" -- OK, then why do you also try to pull it from Maven? If you want to use the JAR, delete the `compile` or `implementation` line where you are trying to pull in `com.googlecode.openbeans:openbeans:1.0`. I don't know that there is a copy of `com.googlecode.openbeans` in a repository somewhere -- it does not show up [in a repo search](https://mvnrepository.com/search?q=com.googlecode.openbeans). – CommonsWare Oct 16 '20 at 00:03
  • @CommonsWare I don't know what you mean by "trying to pull it from Maven" I'm not even using Maven in this project... I am following the instructions from this thread on how to correctly add .jar files to IntelliJ projects. https://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project – InjeffiniteIntegral Oct 16 '20 at 00:33
  • "I don't know what you mean by "trying to pull it from Maven" I'm not even using Maven in this project" -- you are attempting to pull artifacts from repositories, and most of those are Maven repositories. "I am following the instructions from this thread on how to correctly add .jar files to IntelliJ projects" -- none of the answers seem to tell you to add a Gradle line to pull in from Maven coordinates, which is what `compile group: 'com.googlecode', name: 'openbeans', version: '1.0'` and `implementation 'com.googlecode.openbeans:openbeans:1.0'`. Delete those lines if you want to use the JAR. – CommonsWare Oct 16 '20 at 00:44
  • If, instead, you wish to pull this from a Maven repository (as your MVNRepository reference would suggest), you need to start by getting rid of the JAR. Then, since this artifact is in an atypical repository, you would need to add instructions to your module to teach Gradle where this repository resides. I have never used RedHat's Maven repositories, but https://maven.repository.redhat.com/ga/ may be the URL to use. So, try `repositories { maven { url "https://maven.repository.redhat.com/ga/" } }`. See https://docs.gradle.org/current/userguide/declaring_repositories.html for more. – CommonsWare Oct 16 '20 at 00:48
  • @CommonsWare Maybe the confusion is coming from a misunderstanding in what is code in my project and what is not. As far as I know, there is not even a mention of maven anywhere in my code. the `compile group: 'com.googlecode', name: 'openbeans', version: '1.0' and implementation 'com.googlecode.openbeans:openbeans:1.0'` is an example of what I see on the website, which I am using as a visual reference in order to create the line `implementation 'com.googlecode:openbeans:1.0'` in my build.gradle file. No Maven implementation or even Maven framework in my project or code. First block is my code – InjeffiniteIntegral Oct 16 '20 at 01:03
  • "As far as I know, there is not even a mention of maven anywhere in my code" -- with the exception of `implementation fileTree(dir: "libs", include: ["*.jar"])`, every line in your `dependencies` closure is attempting to pull in artifacts from repositories, and the vast majority of those repositories are Maven repositories. You linked to https://mvnrepository.com, which is an index of Maven repositories. "No Maven implementation or even Maven framework in my project or code" -- Gradle, among other build tools, have the ability to pull artifacts from Maven repositories. – CommonsWare Oct 16 '20 at 11:09
  • So, if you want to use the JAR, that's fine, and simply get rid of `compile group: 'com.googlecode', name: 'openbeans', version: '1.0'` and `implementation 'com.googlecode.openbeans:openbeans:1.0'`. If you want to use the repository, remove the JAR, teach Gradle where the repository is, and keep the `implementation 'com.googlecode.openbeans:openbeans:1.0'` line. – CommonsWare Oct 16 '20 at 11:11
  • I am not having any luck with any of the methods. I was using openbeans to work alongside univocity parser, but since I can't get that to work I'll be using OpenCSV instead. Thank you! @CommonsWare – InjeffiniteIntegral Oct 16 '20 at 17:09

0 Answers0