Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio and Gradle, argument 0 for @NotNull parameter

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?

like image 378
Joakim Engstrom Avatar asked Jun 13 '13 10:06

Joakim Engstrom


3 Answers

If you are using Linux, remember that uninstalling an application does not remove the previous configuration files used by Android Studio and X-Window.

So before launching your updated AS, remove the following files:

~/.AndroidStudio*
~/.java/.userPrefs
like image 80
JP Ventura Avatar answered Nov 12 '22 01:11

JP Ventura


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.

like image 43
Joakim Engstrom Avatar answered Nov 12 '22 00:11

Joakim Engstrom


I had this error, and it appeared to be because android and android-gradle facets were somehow added to the parent module the project.

Removing these facets in Project Properties> Modules fixed the problem.

like image 1
brmcmaho Avatar answered Nov 12 '22 00:11

brmcmaho