簡體   English   中英

配置項目react-native-photo-view時發生錯誤

[英]error occurred configuring project react-native-photo-view

我剛剛開始使用ReactNative並使用本教程創建了一個項目。 該項目已建成,並且在我的手機上安裝了android應用程序。

然后,我將@shoutem/ui庫用於UI組件。 根據文檔 ,我嘗試了

npm install @shoutem/ui --save
react-native link

然后使用運行項目

react-native run-android

但是后來我得到了這個錯誤

PS D:\SK\Study\ReactNative\DemoRN> react-native run-android
Scanning folders for symlinks in D:\SK\Study\ReactNative\DemoRN\node_modules (38ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
File C:\Users\sukumar\.android\repositories.cfg could not be loaded.
Failed to download any source lists!
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-photo-view'.
      > Failed to find Build Tools revision 25.0.0

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

BUILD FAILED

Total time: 11.028 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

然后我取消鏈接@shoutem/ui

react-native unlink @shoutem/ui

並嘗試運行該項目,但是仍然面臨着同樣的問題?

請問是否太基礎了,但是我不明白是什么問題?

更新

我沒有使用Android Studio,所以我下載了build-tools 25.0.0並放在sdk / build-tools文件夾中。 但是現在我面對

> A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23

這似乎與您安裝Android Studio時可用的SDK工具有關:

      > Failed to find Build Tools revision 25.0.0

安裝這些應該可以解決問題。 要安裝此程序,請啟動Android Studio,轉到“ SDK管理器”,然后選擇“ SDK工具”選項卡,選中右下角的“ Show Package Details選項,然后檢查25.0.0 SDK工具,然后單擊“應用”以下載並安裝它們。

這是我用於本地環境以供參考的SDK工具的屏幕截圖:

在此處輸入圖片說明

此外,我只想詳細說明react-native (un)link命令。 這用於將本地依賴項鏈接到您的React Native項目中。 取消鏈接與卸載不一樣,取消鏈接后,您仍然應該能夠使用Shoutem UI Toolkit的所有非本機組件。

我沒有使用Android Studio,因此我下載了構建工具25.0.0並放在SDK / build-tools文件夾中。 這解決了構建工具的問題,但是又出現了一個新問題

A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23 

我使用的網絡已配置了一些防火牆規則,這些規則不允許下載所需的依賴項。 當您運行react-native run-android它將自動下載所有依賴項以創建構建。

因此,以我為例,我更改了網絡設置,並且此方法可行。

暫無
暫無

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

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