Android Nativescript gradle项目级别
我想在我的NativeScript应用程序中使用带有Firebase的Segment。因此,我必须遵循以下说明:但我必须修改两个文件:模块级build.gradle:Android Nativescript gradle项目级别,android,gradle,nativescript,Android,Gradle,Nativescript,我想在我的NativeScript应用程序中使用带有Firebase的Segment。因此,我必须遵循以下说明:但我必须修改两个文件:模块级build.gradle: buildscript { dependencies { // Add these lines compile 'com.segment.analytics.android:analytics:4.+' compile 'com.segment.analytics.andro
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'
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' }
}
}
以及项目级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'
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文档不是最好的,这对我很有用,所以可能对你不起作用。 这适用于插件和常规应用程序 构建脚本Gradle App_Resources/Android/buildscript.gradle 插件buildscript.gradle 应用级 插件包括.gradle App_Resources/Android/App.gradle 然而 编译配置仍然存在,但不应使用,因为它不会提供api和实现配置提供的保证 你也可以这样写 应用级 插件包括.gradle App_Resources/Android/App.gradle
任何要添加的依赖项,都可以将其添加到项目级别的build.gradle中。如果我尝试将两者放在同一个build.gradle文件中,我有一个错误,无法在org.gradle.api.internal.artifacts.dsl.dependency.DefaultDependencyHandler.类型的对象上找到参数[com.segment.analytics.android:analytics:4.+]的方法compile。。我在一个原生Android项目中尝试将所有内容都放在级别项目build.gradle中,但我也有同样的错误
dependencies {
implementation 'com.segment.analytics.android:analytics:4.+'
implementation 'com.segment.analytics.android.integrations:firebase:+'
}