問(wèn)題:華為庫(kù)下載不了唾琼,導(dǎo)致gradle同步失敗
解決:
去掉華為推送在線(xiàn)下載相關(guān)代碼佛点,將在線(xiàn)下載修改為離線(xiàn)加載aar庫(kù)
1志秃、通過(guò)Maven 倉(cāng)庫(kù)離線(xiàn)包下載地址下載關(guān)于推送的包:
http://developer.huawei.com/repo/com/huawei/android/hms/base/2.6.3.301/base-2.6.3.301.aar
http://developer.huawei.com/repo/com/huawei/android/hms/base/2.6.3.301/push-2.6.3.301.aar
并將下載的arr包放在需要接入華為推送的module的lib文件夾下
2牌废、去掉在線(xiàn)下載的代碼:
將以下代碼注釋或者刪掉:
maven { url 'http://developer.huawei.com/repo/' }
implementation 'com.huawei.android.hms:push:2.5.2.300'
3隘庄、在引入華為推送的module的build.gradle文件中做如下修改:
在android和dependencies之前添加:
repositories{
jcenter()
flatDir{
dirs 'libs'
}
}
并且dependencies中添加如下如下代碼:
implementation(name:'base-2.6.3.301', ext:'aar')
implementation(name:'push-2.6.3.301', ext:'aar')
4姑荷、如果要引入華為推送的是module髓抑,則在依賴(lài)這個(gè)module的module的build.gradle文件中添加如下代碼:
repositories{
jcenter()
flatDir{
dirs '../xx模塊名/libs'
}
}
然后clean嘴拢、rebuild即可胜榔。