1
我最近向我的react-native項目添加了一個庫。在添加此依賴項之前,該項目運行良好。然而,當我嘗試tryi到現在通過react-native run-android
運行它,我得到這個錯誤:新的依賴關係React native - gradle clean - 無法解決所有依賴關係
File C:\Users\user\.android\repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app > project :react-native-onesignal
* 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: 1 mins 57.711 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
編輯:Android模擬器當然運行。 做了索姆研究後,我發現我可以嘗試npm卸載並安裝,沒有成功。在build.gradle中,我已經指定了我的onesignal_app_id,並且依賴關係爲compile 'com.onesignal:OneSignal:23.0.1'
。因此,我嘗試了產生此錯誤的gradle clean:
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-onesignal'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s