由于@NotNull参数' aFileName'而Gradle无法同步为空

时间:2015-09-24 04:19:13

标签: android android-studio gradle android-gradle

将项目导入Android Studio 1.3.0后,gradle开始建立项目并抛出错误

00:47:21 Gradle sync started
00:47:25 Gradle sync failed: Argument for @NotNull parameter 'aFileName' of com/intellij/openapi/util/io/FileUtil.toSystemIndependentName must not be null
00:47:25 Gradle sync completed
00:47:26 IllegalArgumentException: Failed to set up Android modules in project 'Lab3a_IntentsLab': Argument for @NotNull parameter 'aFileName' of com/intellij/openapi/util/io/FileUtil.toSystemIndependentName must not be null

我不知道是不是因为我导入错误或者是其他问题。这是异常追踪。

Failed to set up Android modules in project 'Lab3a_IntentsLab': Argument for @NotNull parameter 'aFileName' of com/intellij/openapi/util/io/FileUtil.toSystemIndependentName must not be null
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'aFileName' of com/intellij/openapi/util/io/FileUtil.toSystemIndependentName must not be null
at com.intellij.openapi.util.io.FileUtil.toSystemIndependentName(FileUtil.java)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformDir(AndroidSdkUtils.java:216)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformAndAddOnJars(AndroidSdkUtils.java:120)
at org.jetbrains.android.sdk.AndroidSdkUtils.getLibraryRootsForTarget(AndroidSdkUtils.java:154)
at org.jetbrains.android.sdk.AndroidSdkUtils.setUpSdk(AndroidSdkUtils.java:402)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:352)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:334)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:325)
at org.jetbrains.android.sdk.AndroidSdkUtils.tryToCreateAndroidSdk(AndroidSdkUtils.java:610)
at com.android.tools.idea.gradle.customizer.android.AndroidSdkModuleCustomizer.customizeModule(AndroidSdkModuleCustomizer.java:76)
at com.android.tools.idea.gradle.customizer.android.AndroidSdkModuleCustomizer.customizeModule(AndroidSdkModuleCustomizer.java:41)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.customizeModule(AndroidProjectDataService.java:330)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.access$100(AndroidProjectDataService.java:88)
at com.android.tools.idea.gradle.service.AndroidProjectDataService$1.run(AndroidProjectDataService.java:159)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.doImport(AndroidProjectDataService.java:136)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.importData(AndroidProjectDataService.java:122)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:132)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:102)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:141)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:148)
at com.android.tools.idea.gradle.util.Projects$1$1$1.run(Projects.java:128)
at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.mergeRootsChangesDuring(ProjectRootManagerImpl.java:328)
at com.android.tools.idea.gradle.util.Projects$1$1.run(Projects.java:124)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.android.tools.idea.gradle.util.Projects$1.run(Projects.java:120)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2369)
at com.android.tools.idea.gradle.util.Projects.populate(Projects.java:113)
at com.android.tools.idea.gradle.project.ProjectSetUpTask$2.run(ProjectSetUpTask.java:113)
at com.intellij.ide.startup.impl.StartupManagerImpl$7.run(StartupManagerImpl.java:369)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

我想知道这意味着什么,以及如何解决它。

顶级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+'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

模块本身的gradle.build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 18
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "course.labs.intentslab"
        minSdkVersion 14
        targetSdkVersion 19

        testApplicationId "course.labs.intentslab.tests"
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1+'
}

1 个答案:

答案 0 :(得分:0)

我删除了编译sdk版本的sdk平台并在sdk manager中重新加载它。这解决了问题。或者像提问者说的那样,更改compileSdkVersion是另一种方式。