我正在嘗試安裝此庫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)或允許不安全的協議。 有關詳細資訊,請參閱 https://docs.gradle.org/7.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol 。
問題可能在此檔案 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 }
uj5u.com熱心網友回復:
真正的問題是這一行:
jcenter { url "http://jcenter.bintray.com/" }
這是https://github.com/januslo/react-native-bluetooth-escpos-printer/blob/master/android/build.gradle的第 3 行
我認為應該是:
jcenter { url "https://jcenter.bintray.com/" }
要么
jcenter { url "http://jcenter.bintray.com/"; allowInsecureProtocol = true }
請注意,Gradle(故意!)不提供關閉這些檢查的方法,除非根據具體情況。檔案說:
“出于安全目的,這有意要求用戶根據具體情況選擇使用不安全的協議。
Gradle 故意不提供允許通用禁用此檢查的全域系統/gradle 屬性。”
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/428800.html
