我想在我的 NativeScript 应用程序中使用 Segment(与 Firebase)。所以我必须遵循这个指示:https://segment.com/docs/destinations/firebase但我必须修改两个文件:模块级 build.gradle:
buildscript {
dependencies {
// Add these lines
compile 'com.segment.analytics.android:analytics:4.+'
compile 'com.segment.analytics.android.integrations:firebase:+'
}
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
和项目级 build.gradle :
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
// Add this line
maven { url 'https://maven.google.com' }
}
}
但是对于 NativeScript,我只有一个 build.gradle。那么,如何在 gradle 中实现这些行?
谢谢 !
最佳答案
我知道这个问题很老,但他们将来可能会帮助某人。 Nativescript Docs 不是最好的,这对我有用,所以它可能不适合你。
这适用于插件和常规应用程序。
构建脚本 Gradle .
App_Resources/Android/buildscript.gradle
buildscript.gradle
repositories {
// Add this line
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.google.gms:google-services:3.1.0'
}
应用等级
include.gradle
App_Resources/Android/app.gradle
dependencies {
compile 'com.segment.analytics.android:analytics:4.+'
compile 'com.segment.analytics.android.integrations:firebase:+'
}
apply plugin: 'com.google.gms.google-services'
然而
The compile configuration still exists but should not be used as it will not offer the guarantees that the api and implementation configurations provide.https://docs.gradle.org/current/userguide/java_library_plugin.html
你也可以这样写
应用等级
include.gradle
App_Resources/Android/app.gradle
dependencies {
implementation 'com.segment.analytics.android:analytics:4.+'
implementation 'com.segment.analytics.android.integrations:firebase:+'
}
关于android - Nativescript gradle 项目级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54791649/