我正在尝试在本地网段中进行自动化android构建(即无法访问公共jcenter或maven存储库)。为了做到这一点,我需要在从根build.gradle引用的本地maven存储库中提供所有依赖项。 (注意:如果我使用android-maven-plugin而不是gradle,则情况相同)。
这很好用,只有我找不到firebase-core-9.4.0.jar或firebase-messaging-9.4.0.jar这样的firebase库有困难。根据gradle控制台输出,他们在一个位置搜索
<server>/com/google/firebase/firebase-messaging/9.4.0/firebase-messaging-9.4.0.jar
公共jcenter或maven存储库中不存在此位置。
有谁知道在哪里找到它们?
编辑:我在使用Wireshark的空缓存上观察过Android Studio(使用http作为jcenter存储库)。结果相当神秘。它发出
的GET请求http://jcenter.bintray.com/com/google/firebase/firebase-messaging/9.4.0/firebase-messaging-9.4.0.jar
此请求被重定向到
后一个GET请求导致HTTP 404,因为repo.jfrog.org存储库在firebase-messaging /目录中没有内容。但是,Android Studio会在构建目录中提取jar文件并继续构建项目。目前还不清楚jar文件的来源。
答案 0 :(得分:1)
According to this, you should add to you build.gradle:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1'
and that to your app/build.gradle:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:11.8.0'
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
答案 1 :(得分:1)
您可以在官方支持中显示所有图书馆。
答案 2 :(得分:1)
答案 3 :(得分:0)
更新2020
Firebase aar
现在在https://mvnrepository.com/artifact/com.google.firebase的maven存储库中可用
例如,firebase-core aar
位于https://maven.google.com/com/google/firebase/firebase-core/17.4.4/firebase-core-17.4.4.aar