簡體   English   中英

對存儲庫使用不安全的協議 build.gradle 反應原生

[英]Using insecure protocols with repositories build.gradle react native

我正在嘗試安裝這個庫https://github.com/januslo/react-native-bluetooth-escpos-printer在手動將它鏈接到項目后我得到了這個錯誤

配置項目“:react-native-bluetooth-escpos-printer”時出現問題。

無法解析配置“:react-native-bluetooth-escpos-printer:classpath”的所有依賴項。 不支持在沒有明確選擇加入的情況下對存儲庫使用不安全的協議。 切換 Maven 存儲庫 'BintrayJCenter( http://jcenter.bintray.com/ )' 以重定向到安全協議(如 HTTPS)或允許不安全的協議。 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.

問題可能在此文件中 build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(':react-native-bluetooth-escpos-printer')
    ...
    }

我知道我應該使用allowInsecureProtocol但由於我不熟悉 Java 我不知道如何獲得與下面的代碼相同的結果

maven { url "http://myorg.example/repo"; allowInsecureProtocol = true }

真正的問題是這一行:

jcenter { url "http://jcenter.bintray.com/" }

這是https 的第 3 行://github.com/januslo/react-native-bluetooth-escpos-printer/blob/master/android/build.gradle

我認為應該是:

jcenter { url "https://jcenter.bintray.com/" }

或者

jcenter { url "http://jcenter.bintray.com/"; allowInsecureProtocol = true }

請注意,Gradle(故意!)不提供關閉這些檢查的方法,除非根據具體情況。 文檔說:

“出於安全目的,這有意要求用戶根據具體情況選擇使用不安全的協議。

Gradle 故意不提供允許通用禁用此檢查的全局系統/gradle 屬性。”

問題是使用不安全的 jcentre 端點。 考慮使用自動加載的系統定義端點。

而不是jcenter { url "http://jcenter.bintray.com/" }

使用jcenter()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM