Android studio项目未配置

Android studio项目未配置,android,Android,今天,我启动了我的android studio,所有的都没有配置。类显示了很多错误。这是android studio在我尝试运行应用程序时显示的错误: 错误:java.lang.NullPointerException(无错误消息) 这是我的格拉德尔: apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "25.0.1"

今天,我启动了我的android studio,所有的都没有配置。类显示了很多错误。这是android studio在我尝试运行应用程序时显示的错误:

错误:java.lang.NullPointerException(无错误消息)

这是我的格拉德尔:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "25.0.1"
        defaultConfig {
            applicationId "com.example.garcia.coachtrain"
            minSdkVersion 21
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_6
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.squareup.okhttp3:okhttp:3.3.0'
        compile 'com.roomorama:caldroid:3.0.1'
        compile 'com.android.support:design:23.0.1'
        testCompile 'junit:junit:4.12'
    }

i add the new gradle:



  apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion '25.0.1'
        defaultConfig {
            applicationId "com.example.garcia.coachtrain"
            minSdkVersion 21
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.1.0'
        compile 'com.squareup.okhttp3:okhttp:3.3.0'
        compile 'com.roomorama:caldroid:3.0.1'
        compile 'com.android.support:design:25.0.1'
        testCompile 'junit:junit:4.12'
    }
如果我使用这个sdk版本,编译'com.roomorama:caldroid:3.0.1'就不起作用了。java类找不到caldroid


谢谢

尝试将sdk更新为最新版本,因为编译sdk版本和生成工具版本不同

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "codingtown.coconut"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:design:24.1.1'
    compile 'com.android.support:cardview-v7:24.1.1'
    compile 'com.google.android.gms:play-services-places:9.4.0'
    compile 'com.itextpdf:itext-pdfa:5.5.8'
    compile 'com.itextpdf.tool:xmlworker:5.5.8'
}

清理项目,然后重新启动android studio。

我通过以下方法解决了它:

文件菜单-->使缓存无效/重新启动

在警告窗口-->中,选择“无效/重新启动”

这解决了我的问题,我保留了gradle配置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.1'
    defaultConfig {
        applicationId "com.example.garcia.coachtrain"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.squareup.okhttp3:okhttp:3.3.0'
    compile 'com.roomorama:caldroid:3.0.1'
    compile 'com.android.support:design:23.0.1'
    testCompile 'junit:junit:4.12'
}

因为您的编译器DKVersion 23 buildToolsVersion“25.0.1”不相同,我将编译器DKVersion 23 buildToolsVersion“25.0.1”更改为编译器DKVersion 23 buildToolsVersion“23.0.0”,但它不起作用。Nidhin kumar,昨天我的项目工作正常,所以我认为这不是问题所在。试着重建这个项目一次又一次,我试着重建,但都是一样的。我快疯了