Reputation: 337
As I remember I haven't edited anything in my Gradle and suddenly I realized I can not sync project Gradle anymore,
this error is shown to me:
ERROR: Cannot invoke method buildTypes() on null object
I've searched about my problem in StackOverflow and find some similar questions but none of the works for me
this is my Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.myapp.test"
minSdkVersion 18
targetSdkVersion 27
//todo: change the versionCode and the versionName before upload in store
versionCode 22
versionName "2.4.0"
aaptOptions {
additionalParameters "--no-version-vectors"
}
} buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.google.firebase:firebase-crash:16.2.1'
testImplementation 'junit:junit:4.12'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'agency.tango.android:material-intro-screen:0.0.5'
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true
}
implementation ('com.crashlytics.sdk.android:crashlytics-ndk:2.0.4@aar') {
transitive = true
}
}
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
I have no idea how to fix it so I need your help.
Upvotes: 2
Views: 287
Reputation: 363439
Move the buildTypes
statement to the next line.
Use
}
buildTypes {
instead of
} buildTypes {
Upvotes: 2