Я пытаюсь добавить сигнал в мой проект gradle.
Однако я получаю следующую ошибку:
build file '/tmp/workspace/myapp-develop/My_app/android/app/build.gradle': 196: only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed
Файл build.gradle моего приложения gradle выглядит так:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
configurations.all {
resolutionStrategy.force 'com.google.android.gms:play-services-gcm:11.8.0'
resolutionStrategy.force 'com.google.android.gms:play-services-analytics:11.8.0'
resolutionStrategy.force 'com.google.android.gms:play-services-location:11.8.0'
resolutionStrategy.force 'com.facebook.android:facebook-android-sdk:4.18.0'
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "my.android.mobileapp"
minSdkVersion 16
targetSdkVersion 25
versionCode 24
versionName "0.0.24"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [
'onesignal_app_id': "xxxxx-xxxxx-xxx-xxxxx",
'onesignal_google_project_number': "12345676789"
]
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-fabric')
compile project(':react-native-spinkit')
compile project(':react-native-push-notification')
compile project(':react-native-google-analytics-bridge')
compile project(':react-native-svg')
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-fabric')
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true;
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.10.2' apply false
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
Я пытался:
Ничего из этого не помогло.
Где именно я должен добавить оператор plugin
?Кроме того, my_app/android/app/build.gradle
правильный файл для добавления оператора plugin
в?