react-native-video的坑

今天本來想用react-native這個(gè)庫做視頻,
首先我執(zhí)行命令

yarn add react-native-video

然后link

react-native link react-native-video

如果link失敗,就自己添加


react-native-video-.png

react-native-video-one.png

然后我運(yùn)行項(xiàng)目,結(jié)果出錯(cuò)了,報(bào)錯(cuò)如下:

                                                                     
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-video'.
      > Could not resolve all dependencies for configuration ':react-native-video:_debugPublishCopy'.
         > Could not find com.android.support:support-annotations:27.0.0.
           Searched in the following locations:
               file:/C:/Users/asus/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotation
s/27.0.0/support-annotations-27.0.0.pom
               file:/C:/Users/asus/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotation
s/27.0.0/support-annotations-27.0.0.jar
               file:/D:/RNProject/Small/android/sdk-manager/com/android/support/support-annotations/27.0.0/support-annotations-
27.0.0.jar
           Required by:
               Small:react-native-video:unspecified > com.google.android.exoplayer:extension-okhttp:2.7.3
               Small:react-native-video:unspecified > com.google.android.exoplayer:exoplayer:2.7.3 > com.google.android.exoplay
er:exoplayer-core:2.7.3
               Small:react-native-video:unspecified > com.google.android.exoplayer:exoplayer:2.7.3 > com.google.android.exoplay
er:exoplayer-dash:2.7.3
               Small:react-native-video:unspecified > com.google.android.exoplayer:exoplayer:2.7.3 > com.google.android.exoplay
er:exoplayer-hls:2.7.3
               Small:react-native-video:unspecified > com.google.android.exoplayer:exoplayer:2.7.3 > com.google.android.exoplay
er:exoplayer-smoothstreaming:2.7.3
               Small:react-native-video:unspecified > com.google.android.exoplayer:exoplayer:2.7.3 > com.google.android.exoplay
er:exoplayer-ui:2.7.3

這個(gè)問題的核心在于這句話:

Could not find com.android.support:support-annotations:27.0.0.

在github上我找到了答案:


react-native-video-five.png

于是我就開始各種百度,谷歌,終于讓我找到了解決方案:
這種問題主要是兩個(gè)方面:
1、Repository問題。需要在android studio上更新版本。
詳情見:https://stackoverflow.com/questions/37026322/failed-to-sync-gradle-could-not-find-com-android-supportsupport-annotations23

react-native-video-three.png

2.還有一種情況就是沒有加goole 依賴(哈哈,我自創(chuàng)的名字)
在build.grade(不是app里面那個(gè)喲)
添加:

maven {
url "https://maven.google.com"
}

如圖:
react-native-video-four.png

再次運(yùn)行!完美執(zhí)行!搞定!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • afinalAfinal是一個(gè)android的ioc,orm框架 https://github.com/yangf...
    passiontim閱讀 15,837評論 2 45
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,506評論 19 139
  • 總結(jié)一下:1、龍湖的售樓部現(xiàn)代,奢華. 性價(jià)比高. 售樓妹子最美最帥,主動提供房子資料。2、旭輝,索取資料兩次...
    馬唐閱讀 584評論 0 0
  • 相信有不少朋友看過類似于這樣標(biāo)題的文章吧,《如果你想失去一個(gè)朋友,那么請借給他錢吧》,我想同意作者觀點(diǎn)的朋友大有人...
    土豆不太熟閱讀 599評論 4 7
  • 在回去的車上看完了《你一生的故事》。相比于電影,小說內(nèi)容更連續(xù),易懂。物理學(xué)家刷足了存在感。但小說故事性相比電影來...
    yltianxia閱讀 552評論 0 2

友情鏈接更多精彩內(nèi)容