Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 3.1 build gradle 4.4 error occurred configuring project ':app'

Tags:

When i build app to android studio 3.1 with emulator api<26 not error, but when i build api>26 error. i have not to use kotlin because not import kotlin,but build api>26 error. > kotlin.KotlinNullPointerException (no error message).

com.android.build.gradle.tasks.ir.InstantRunMainApkResourcesBuilder$ConfigAction.execute(InstantRunMainApkResourcesBuilder.kt:129)

Build gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "vn.top12.app"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled = true
        // blur
        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    signingConfigs {
        release {
            keyAlias "top12vn"
            keyPassword "top12vn"
            storeFile file('key_store/top12_released_key.keystore')
            storePassword "top12vn"

        }
        debug {
            keyAlias "top12vn"
            keyPassword "top12vn"
            storeFile file('key_store/top12_released_key.keystore')
            storePassword "top12vn"
        }
    }
    lintOptions {
        checkReleaseBuilds true
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
    buildToolsVersion '27.0.3'

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    //them multiDexEnabled = true
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    // butter knife.
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    // gson.
    implementation 'com.google.code.gson:gson:2.8.2'
    // image loading.
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    //    com.squareup.retrofit2
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    //com.squareup.okhttp3
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    //    reactive
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
    // keyboard keyboardvisibilityevent
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
    // com.google.firebase.
    implementation 'com.google.firebase:firebase-messaging:12.0.1'
    // Cloud Messaging
    implementation 'com.google.firebase:firebase-core:12.0.1'
    //Analytics
    implementation 'com.google.firebase:firebase-invites:12.0.1'
    //Invites and Dynamic Links
    // ViewModel and LiveData
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    //room Save data in a local database using Room
    implementation 'android.arch.persistence.room:runtime:1.0.0'
    annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
    //push onesignal
    //  implementation 'com.onesignal:OneSignal:3.7.1'
    //gmc
    implementation 'com.google.android.gms:play-services-gcm:12.0.1'
    //exoplayer-textureview
    implementation 'com.google.android.exoplayer:exoplayer:2.7.0'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

Build gradle app:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.1.1'
        // google-services plugin


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
like image 600
QuestionAndroid Avatar asked Apr 01 '18 06:04

QuestionAndroid


1 Answers

Not a permanent solution, but to get instant run working again, downgrade your project gradle to

classpath 'com.android.tools.build:gradle:3.0.1' (instead of 3.1.0) and in your app/build.gradle, downgrade buildTools: buildToolsVersion '27.0.0' (instead of 27.0.3)

This will allow you to use instant run again. hopefully they will fix the issue with 3.1.0 & 27.0.3 in a future release...

like image 121
SnowyTracks Avatar answered Sep 19 '22 12:09

SnowyTracks