Gradle项目同步失败的Android Studio 3.1

时间:2018-08-04 03:24:18

标签: android android-studio kotlin android-gradle

我尝试同步gradle,但是我收到Gradle项目同步失败,基本功能可能无法正常工作。

这是我的应用gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "com.example.nawaf.fbm"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//anko
implementation "org.jetbrains.anko:anko:$anko_version"
implementation "org.jetbrains.anko:anko-design:$anko_version"
implementation "org.jetbrains.anko.anko-coroutines:$anko_version"

//firebase
implementation "com.google.firebase:firebase-core:11.8.0"
implementation "com.google.firebase:firebase-firestore:11.8.0"  
implementation "com.google.firebase:firebase-auth:11.8.0"
implementation "com.firebaseui:firebase-ui-auth:3.2.2"

kotlin {
    experimental {
        coroutines "enable"
    }
}
}

这是我在idea.log文件中遇到的错误

2018-08-03 22:47:04,143 [e-1024-b02]  ERROR - llij.ide.plugins.PluginManager             - VM: OpenJDK 64-Bit Server VM 
2018-08-03 22:47:04,143 [e-1024-b02]  ERROR - llij.ide.plugins.PluginManager     -     Vendor: JetBrains s.r.o 
2018-08-03 22:47:04,143 [e-1024-b02]  ERROR - llij.ide.plugins.PluginManager - OS: Windows 10 
2018-08-03 22:47:04,143 [e-1024-b02]  ERROR - llij.ide.plugins.PluginManager - Last Action: EditorBackSpace 
2018-08-03 22:47:04,143 [e-1024-b02]  ERROR - llij.ide.plugins.PluginManager              null 

java.lang.NullPointerException

我正在使用Firebase制作消息应用程序

1 个答案:

答案 0 :(得分:0)

我认为kotlin-stdlib-jre7库已过时

替换

implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

使用

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version'

注意:升级$ kotlin_version:1.2.51并重新同步Gradle