Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android error during build - "default public constructor with no argument must be declared". What's the cause?

Android studio returned an error during build, even after running Clean, and rebuilding:

A default public constructor with no argument must be declared if a custom constructor is declared.

I could not find a line number, nor a file referenced. I have no idea what causes this, as there's no indication from the build where or what the cause of this is.

like image 458
oddmeter Avatar asked Oct 19 '22 00:10

oddmeter


1 Answers

If you have a custom constructor like this

public class Doge extends RealmObject {
     public Doge(String name) {
       ... 

Then you must also have a default constructor with no additional parameters.

public Doge() {
    // default values possible since 2.0.2
} 
like image 150
EpicPandaForce Avatar answered Oct 27 '22 09:10

EpicPandaForce