react-native-ssl-pinning icon indicating copy to clipboard operation
react-native-ssl-pinning copied to clipboard

Not Compatible with RN 0.72

Open pipo151086 opened this issue 2 years ago • 7 comments

trying tu run app with RN 0.72

after upgrading and running react-native run-android i get the following error:

Could not create task ':react-native-ssl-pinning:compileDebugJavaWithJavac'.

In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

BUILD FAILED in 54s error Failed to install the app. Command failed with exit code 1: gradlew.bat tasks 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. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 54s

pipo151086 avatar Jun 22 '23 20:06 pipo151086

Here is the diff that solved our problem using patch-package:

diff --git a/node_modules/react-native-ssl-pinning/android/build.gradle b/node_modules/react-native-ssl-pinning/android/build.gradle
index efb23b8..eae7828 100644
--- a/node_modules/react-native-ssl-pinning/android/build.gradle
+++ b/node_modules/react-native-ssl-pinning/android/build.gradle
@@ -12,7 +12,7 @@ buildscript {
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion 30
     buildToolsVersion "28.0.3"
 
     defaultConfig {

Moayad-92 avatar Jun 26 '23 09:06 Moayad-92

add this in build file inside buildscript-> subprojects { subproject -> afterEvaluate{ if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } }

dogra-deepak-tftus avatar Sep 19 '23 09:09 dogra-deepak-tftus

Did you guys manage to solve this? i tried upgrade the compileSdkVersion to 30 but still face the issue. Can someone help?

HareHanum avatar Sep 26 '23 14:09 HareHanum

Did you guys manage to solve this? i tried upgrade the compileSdkVersion to 30 but still face the issue. Can someone help?

I've made a fork >

https://github.com/MaxToyberman/react-native-ssl-pinning/compare/master...pipo151086:react-native-ssl-pinning:master

"TEMOPORARY WORKAROUD"

pipo151086 avatar Sep 26 '23 14:09 pipo151086

Thanks for the fast respond!

The app still crashes on start and i get the error:

Fatal Exception: java.lang.IllegalStateException: SSLContext is not initialized. at com.android.org.conscrypt.OpenSSLContextImpl.engineGetSocketFactory(OpenSSLContextImpl.java:118) at javax.net.ssl.SSLContext.getSocketFactory(SSLContext.java:338) at kk.a.d(:54) at com.toyberman.RNSslPinningModule.fetch(:85) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.JavaMethodWrapper.invoke(:148) at com.facebook.react.bridge.JavaModuleWrapper.invoke(:147) at com.facebook.jni.NativeRunnable.run(SourceFile) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage() at android.os.Looper.loop(Looper.java:237) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(:37) at java.lang.Thread.run(Thread.java:919)

HareHanum avatar Sep 26 '23 14:09 HareHanum

You have to save .cer file in your assets to make it work.

On Tue, 26 Sep 2023 at 8:17 PM, Harel Hanum @.***> wrote:

Thanks for the fast respond!

The app still crashes on start and i get the error:

Fatal Exception: java.lang.IllegalStateException: SSLContext is not initialized. at com.android.org.conscrypt.OpenSSLContextImpl.engineGetSocketFactory(OpenSSLContextImpl.java:118) at javax.net.ssl.SSLContext.getSocketFactory(SSLContext.java:338) at kk.a.d(:54) at com.toyberman.RNSslPinningModule.fetch(:85) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.JavaMethodWrapper.invoke(:148) at com.facebook.react.bridge.JavaModuleWrapper.invoke(:147) at com.facebook.jni.NativeRunnable.run(SourceFile) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage() at android.os.Looper.loop(Looper.java:237) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(:37) at java.lang.Thread.run(Thread.java:919)

— Reply to this email directly, view it on GitHub https://github.com/MaxToyberman/react-native-ssl-pinning/issues/190#issuecomment-1735696485, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HQZVLAJ6ZK62RAFMSSYXTX4LTHJANCNFSM6AAAAAAZQXMZQA . You are receiving this because you commented.Message ID: @.***>

dogra-deepak-tftus avatar Sep 26 '23 14:09 dogra-deepak-tftus

Ive done that, but still get the same error. on develop the app works fine, the difference between develop to my branch is the whole v0.72 upgrade changes. develop uses version v0.67.5

HareHanum avatar Sep 26 '23 15:09 HareHanum