skip to Main Content

I am trying to implement any kind of dependency ,in new android studio IDE which is stable in JDK 11, like payumoney or something else. It syncs successfully but when trying to use it in java file or xml file getting error like can not find symbol that you are using.

In updated Android Studio when we create new project we are getting code in build.gradle file which is given below :

build.gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
}



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

and build.gradle(app) :

plugins {
    id 'com.android.application'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.wipenex.payudemo"
        minSdk 21
        targetSdk 31
        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
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'com.google.firebase:firebase-common:20.0.0'

    implementation 'com.payumoney.core:payumoney-sdk:7.4.4'
    implementation 'com.payumoney.sdkui:plug-n-play:1.6.0'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    

}

And it looks like :
enter image description here

I was trying to add some code in build.gradle(app) :

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.1'
        classpath 'com.google.gms:google-services:4.3.8'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

but getting error.

2

Answers


  1. Chosen as BEST ANSWER

    I have wrote code before getting exact code or concept behind it after a lot of error handling.

    In my system it works when modified in settings.gradle inside of repositories { } :

    maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
    maven { url "https://jitpack.io" }
    

    The complete settings.gradle file should have as given below :

    pluginManagement {
        repositories {
            gradlePluginPortal()
            google()
            mavenCentral()
        }
    }
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
            maven { url "https://jitpack.io" }
        }
    }
    rootProject.name = "PayU Demo"
    include ':app'
    

    I hope the above code helpful to you all guys.


  2. It seems, that the dependency can not be loaded from JCenter. PayU mentioned in their [developer guide][1], that implementation("com.payumoney.sdkui:plug-n-play:<version>") is enough.

    I recommend to remove the other payumoney dependencies and change your repository scope in the build.gradle to

    repositories {
            google()
            mavenCentral()
            maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
            maven { url "https://jitpack.io" }
        }
    ``
    
    
      [1]: https://developer.payumoney.com/android/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search