无法在Android Studio中运行任何JAVA模块

时间:2015-08-24 09:38:40

标签: java android android-studio android-gradle

将Android Studio更新为1.3.1并使用gradle构建工具1.3.0后,我无法在Android Studio中运行任何Java模块!起初我真的处于离线模式,但是当我依赖库时,我关闭了它。我在执行clean --refresh-dependencies后同步gradle,但它没有工作。即使我将lombok-ast-0.2.3.jar放在C:\Users\.AndroidStudio1.3\system\jars\中,问题仍然存在。谢谢你的帮助!

logcat的

  

错误:Gradle:配置根项目' SimpleWeather'时出现问题。   无法解析配置':classpath'的所有依赖项。   无法下载lombok-ast.jar(com.android.tools.external.lombok:lombok-ast:0.2.3):没有可用于离线模式的缓存版本

build.gradle(模块:根项目)

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
        classpath 'com.android.tools.external.lombok:lombok-ast:0.2.3'

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

allprojects {
    repositories {
        jcenter()
    }
}

的build.gradle(模块:应用)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        applicationId "me.rorschach.simpleweather"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            java.srcDirs = ['src/main/java', 'src/main/java-gen']
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'de.greenrobot:greendao:2.0.0'
}

build.gradle(模块:java模块)

apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'de.greenrobot:greendao-generator:2.0.0'
}

1 个答案:

答案 0 :(得分:1)

检查您的Android Studio偏好设置。您可能已经检查了脱机工作。

Android Studio > Preferences > Build, Execution, Deployment > Gradle > Offline Work

确保未选中该复选框。