groupdocs-viewer-cloud / groupdocs-viewer-cloud-java

Java SDK to communicate with GroupDocs.Viewer REST API. View or render Word, Excel, PowerPoint, CAD, Visio, PDF, OpenDocument, email & image formats.
https://products.groupdocs.cloud/viewer/java
MIT License
2 stars 3 forks source link

Could not find com.groupdocs:groupdocs-viewer-cloud:21.8. #3

Closed mrcodecloud closed 3 years ago

mrcodecloud commented 3 years ago

I can successfully add the dependencies, and maven url to the app, and project gradle files respectively for my android project and then Sync android project. But Still I am getting this error when rebuilding the project. Also while Importing looks like groupdocs isn't included in my project.

Project level gradle file

buildscript {
      repositories {
           google()
           mavenCentral()
           maven {
              url "https://repository.groupdocs.cloud/repo/"
           }
      }
     dependencies {
     classpath "com.android.tools.build:gradle:7.0.0-beta04"

       // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
      }
}

App level gradle file

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // Groupdocs Dependencies 
    implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8'
}
mrcodecloud commented 3 years ago

I even try adding following dependency but still no luck

implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.8'

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

Please make sure to declare the repositoy at allprojects.repositories section of the project level of build.gradle file e.g.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        maven {
            url 'https://repository.groupdocs.cloud/repo'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And then referencing package at the dependencies section of the app level of build.gradle file e.g.

plugins {
    ...
}

android {
    ...
}

dependencies {
    ...
    implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8'
}
mrcodecloud commented 3 years ago

I did try to do exactly as you mentioned above, but still no luck. I am posting my gradle files here now.

Project level gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.0-beta04"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://repository.groupdocs.cloud/repo'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App level gradle file

plugins {
    id 'com.android.application'
}
android {
    compileSdk 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.it22.myapplication"
        minSdk 21
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

//    implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8'
//    implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.8'
    implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8'
}

I am using JDK 11, and gradle version 7.0.2 with gradle 7 plugin.

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

Can you share the error message?

mrcodecloud commented 3 years ago

Could not find com.groupdocs:groupdocs-viewer-cloud:21.8. Required by: project :app Search in build.gradle files

![Uploading Screenshot at Aug 09 17-34-09.png…]()

mrcodecloud commented 3 years ago

This is the Error message, I am getting

Could not find com.groupdocs:groupdocs-viewer-cloud:21.8. Required by: project :app Search in build.gradle files

mrcodecloud commented 3 years ago
Screenshot at Aug 09 17-34-09
vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

I've prepared a sample app that was created in Android Studio from templates and added a reference to the SDK. Can you try cloning and try building the following app https://github.com/vladimir-litvinchik/referencing-viewer-cloud-in-android-app and checking if the issue still persists?

mrcodecloud commented 3 years ago

Sure, Thanks for the effort. I will try it now, and update you.

mrcodecloud commented 3 years ago

@vladimir-litvinchik Thanks for the sample app, it's working fine. Now I am trying to figure out the difference between your and mine and will report the reason here.

Thanks

mrcodecloud commented 3 years ago

The problem was following code in the project level settings.gradle file

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }
}

It was added by default on creating new app, After commenting this code I got my project build successfully. Thanks @vladimir-litvinchik your sample helped me to find the cause of issue through difference check.

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

Thank you for sharing the root cause of the issue!