本文介绍了Android Studio和Gradle,@ NotNull参数的参数0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Android Studio中的Gradle制作应用程序,但我得到的只是以下错误消息:

java.lang.IllegalArgumentException: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null

我已经尝试调试此功能,但实际上我无法弄清楚问题出在哪里.

有什么想法吗?

解决方案

我已经在Google+上阅读了有关此的一些讨论,由于我的项目仍无法使用Gradle进行编译,因此我认为我仍然做错了一些事情./p>

但是,我已经解决了这个问题,据我了解,如果您使用Gradle,则不必进入模块依赖项,因为它应该从Gradle文件中设置.

所以我能给您的第一条建议是退出Android Studio并删除.idea文件夹以及项目文件夹中的所有.iml文件.

此后,打开Android Studio并导入项目,并记住指向根目录中的build.gradle(基本上,对于项目文件夹,您有一个build.gradle文件,然后对于每个模块都有一个build.gradle文件. ),基本上模仿了新项目的结构.

这几乎可以肯定会解决此问题,并从Gradle启动项目.

但是您可能会在调试过程中遇到其他错误,这可能会使调试变得很麻烦.

但是目前,Android Studio有时会发出非信息性的错误消息.

I'm trying to make an app with Gradle in Android Studio, but all I get is this error message:

java.lang.IllegalArgumentException: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null

I've tried debugging this and I actually can't figure out what the problem is.

Anyone with any ideas?

解决方案

I've had and read some discussion on Google+ about this and I figured I still do a few things wrong since my project still does not compile with Gradle.

BUT, I've fixed this issue and from my understanding is that if you use Gradle you should not have to go into Module Dependencies, because it should be setup from the Gradle files.

So the first advice I can give you is to quit Android Studio and delete the .idea folder and all the .iml files in the project folder.

After this, open Android Studio and import the project, and remember to point to the build.gradle in the root directory (basically you have a build.gradle file for the project folder and then one build.gradle file for every module), basically mimic the structure that a new project has.

This will almost certainly fix this problem and also start the project from Gradle.

But you might encounter other errors along the way which could be a hazzle to debug.

But at the moment Android Studio gives really non-infomative error messages sometimes.

这篇关于Android Studio和Gradle,@ NotNull参数的参数0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 13:19