I'm trying to install this library https://github.com/januslo/react-native-bluetooth-escpos-printer after manually linking it to the project I got this error
A problem occurred configuring project ':react-native-bluetooth-escpos-printer'.
Could not resolve all dependencies for configuration ':react-native-bluetooth-escpos-printer:classpath'. Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'BintrayJCenter(http://jcenter.bintray.com/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
The issue is probably here in this file build.gradle
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':react-native-bluetooth-escpos-printer')
...
}
I'm aware that I should use allowInsecureProtocol
but as I'm not familiar with Java I'm not sure how to achieve the same result as in the code below
maven { url "http://myorg.example/repo"; allowInsecureProtocol = true }
CodePudding user response:
The real problem is this line:
jcenter { url "http://jcenter.bintray.com/" }
It is line #3 of https://github.com/januslo/react-native-bluetooth-escpos-printer/blob/master/android/build.gradle
I think it should be:
jcenter { url "https://jcenter.bintray.com/" }
or
jcenter { url "http://jcenter.bintray.com/"; allowInsecureProtocol = true }
Note that Gradle (deliberately!) doesn't provide a way to turn these checks off except on a case-by-case basis. The docs say:
"For security purposes this intentionally requires a user to opt-in to using insecure protocols on case by case basis.
Gradle intentionally does not offer a global system/gradle property that allows a universal disable of this check."