MaxToyberman / react-native-ssl-pinning

React Native ssl pinning and cookies handling based on okhttp3 on (Android). and AFNetworking on (iOS)
MIT License
335 stars 97 forks source link

Update the Gradle Build Version #189

Open stperona opened 1 year ago

stperona commented 1 year ago

While attempting to build our project today we've began to experience the following error:

A problem occurred configuring project ':react-native-ssl-pinning'.
> Could not determine the dependencies of null.
   > Could not resolve all task dependencies for configuration ':react-native-ssl-pinning:classpath'.
      > Could not find com.android.tools.build:gradle:2.2.0.
        Searched in the following locations:
          - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
          - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
          - https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
        Required by:
            project :react-native-ssl-pinning

It appears the library still depends on Gradle v2.2.0 which is seemingly no longer available in the repos. Is it possible to get a version bump on this dependency and a new release issued?

dhinesh-elumalai commented 1 year ago

+1. Facing the same issue. Please update the version to 2.3.0 which is now available in jcenter

m00nreal commented 1 year ago

Facing same issue on react-native 0.70

saravana-mitrah commented 1 year ago

Facing the same issue any solution for that?

JoNesVai commented 1 year ago

facing the same issue with .71

akucharczyk commented 1 year ago

We fixed it with patch-package and just upgraded the version in the build.gradle

diff --git a/node_modules/react-native-ssl-pinning/android/build.gradle b/node_modules/react-native-ssl-pinning/android/build.gradle
index efb23b8..2fa38bd 100644
--- a/node_modules/react-native-ssl-pinning/android/build.gradle
+++ b/node_modules/react-native-ssl-pinning/android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
     }

     dependencies {
-        classpath 'com.android.tools.build:gradle:2.2.0'
+        classpath 'com.android.tools.build:gradle:2.3.0'
     }
 }
aykutuludag commented 1 year ago

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tasks'.
> Could not create task ':react-native-ssl-pinning:compileDebugJavaWithJavac'.
   > In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

TEMPORARY SOLUTION: change react-native-ssl-pinning/build.gradle as following:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 33
    buildToolsVersion "33.0.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 33
        compileSdkVersion 33
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    mavenCentral()
}

dependencies {
   implementation "com.facebook.react:react-native:+"
    implementation "com.squareup.okhttp3:okhttp:4.9.0"
    implementation "com.squareup.okio:okio:2.6.0"
    implementation "com.github.franmontiel:PersistentCookieJar:v1.0.1"
    implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0"
}

Unfortunately this changes removes every npm/yarn install. There is a need to release update for this library.

himanshi-coder commented 2 weeks ago

facing the same issue

himanshi-coder commented 1 week ago

i was facing this issue since 4 days. and no other solution was worked for me except the changes in node_modules -> react-native-ssl-pinning -> android -> build.gradle file

this is the file after changes ==

buildscript { repositories { mavenCentral() //need to include this because jcenter is deprecated jcenter() }

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0' // need to add the version available on maven repo in my can i found 2.3.0 on this url => https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom  so i added 2.3.0 version 
}

}

apply plugin: 'com.android.library'

android { compileSdkVersion 28 buildToolsVersion "28.0.3"

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
}
lintOptions {
    abortOnError false
}

}

repositories { mavenCentral() }

dependencies { implementation "com.facebook.react:react-native:+" implementation "com.squareup.okhttp3:okhttp:4.9.0" implementation "com.squareup.okio:okio:2.6.0" implementation "com.github.franmontiel:PersistentCookieJar:v1.0.1" implementation "com.squareup.okhttp3:logging-interceptor:4.9.0" implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0" }

==========

need to create the patch if required :)

technocrat-cbs commented 1 week ago

Thanks @himanshi-coder

Your solution worked for me