我在我的Android应用程序中安装领域,只需更改我的bbdd模型并从realmobject扩展并通过realmlist更改列表,我在gradle sync时收到此错误:
with --info or --debug option to get more log output.
异常堆栈跟踪是:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':storage:compileReleaseJava'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) Caused by: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at com.sun.tools.javac.main.Main.compile(Main.java:469)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:42)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:35)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:97)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:158)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:138)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:92)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at com.sun.tools.javac.util.List.get(List.java:421)
at io.realm.processor.RealmProxyClassGenerator.generate(RealmProxyClassGenerator.java:172)
at io.realm.processor.RealmProcessor.process(RealmProcessor.java:73)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
at com.sun.tools.javac.main.Main.compile(Main.java:439)
... 65 more
这是我的模特。
public class WorkDB extends RealmObject {
private String team;
private String clientId;
private String workString;
private String signerName;
private String signPath;
private RealmList photoList;
private Date date;
private String id;
private boolean downloaded;
private String address;
private String postalCode;
private String town;
private String province;
private String phone;
private RealmList<ReportDB> reports;
public WorkDB(String team, String clientId, String workString, Date date, String id, boolean downloaded,
String address, String postalCode, String town, String province, String phone, RealmList<ReportDB> reports) {
super();
this.team = team;
this.clientId = clientId;
this.workString = workString;
this.photoList = new RealmList<>();
this.date = date;
this.id = id;
this.downloaded = downloaded;
this.address = address;
this.postalCode = postalCode;
this.town = town;
this.province = province;
this.phone = phone;
this.reports = reports;
}
public WorkDB() {
this.photoList = new RealmList();
}
public String getTeam() {
return team;
}
public void setTeam(String team) {
this.team = team;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getWorkString() {
return workString;
}
public void setWorkString(String workString) {
this.workString = workString;
}
public String getSignerName() {
return signerName;
}
public void setSignerName(String signerName) {
this.signerName = signerName;
}
public String getSignPath() {
return signPath;
}
public void setSignPath(String signPath) {
this.signPath = signPath;
}
public RealmList getPhotoList() {
return photoList;
}
public void setPhotoList(RealmList photoList) {
this.photoList = photoList;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public boolean isDownloaded() {
return downloaded;
}
public void setDownloaded(boolean downloaded) {
this.downloaded = downloaded;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public RealmList<ReportDB> getReports() {
return reports;
}
public void setReports(RealmList<ReportDB> reports) {
this.reports = reports;
}
}
public class ReportDB extends RealmObject {
private int idReport;
private String nameReport;
private RealmList<ReplieGroupDB> repliesGroup;
private RealmList<QuestionGroupDB> questionGroups;
public ReportDB(int idReport, String nameReport, RealmList<ReplieGroupDB> repliesGroup, RealmList<QuestionGroupDB> questionGroups) {
this.idReport = idReport;
this.nameReport = nameReport;
this.repliesGroup = repliesGroup;
this.questionGroups = questionGroups;
}
public ReportDB() {
}
public List<QuestionGroupDB> getQuestionGroups() {
return questionGroups;
}
public void setQuestionGroups(RealmList<QuestionGroupDB> questionGroups) {
this.questionGroups = questionGroups;
}
public int getIdReport() {
return idReport;
}
public void setIdReport(int idReport) {
this.idReport = idReport;
}
public String getNameReport() {
return nameReport;
}
public void setNameReport(String nameReport) {
this.nameReport = nameReport;
}
public List<ReplieGroupDB> getRepliesGroup() {
return repliesGroup;
}
public void setRepliesGroup(RealmList<ReplieGroupDB> repliesGroup) {
this.repliesGroup = repliesGroup;
}
}
public class ReplieGroupDB extends RealmObject {
private int idReplieGroup;
private String name;
private RealmList<ReplieDB> replies;
private QuestionGroupDB questionGroups;
public ReplieGroupDB(int idReplieGroup, RealmList<ReplieDB> replies, String name, QuestionGroupDB questionGroups) {
super();
this.idReplieGroup = idReplieGroup;
this.replies = replies;
this.name = name;
this.questionGroups = questionGroups;
}
public ReplieGroupDB() {
}
public int getIdReplieGroup() {
return idReplieGroup;
}
public void setIdReplieGroup(int idReplieGroup) {
this.idReplieGroup = idReplieGroup;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public RealmList<ReplieDB> getReplies() {
return replies;
}
public void setReplies(RealmList<ReplieDB> replies) {
this.replies = replies;
}
public QuestionGroupDB getQuestionGroups() {
return questionGroups;
}
public void setQuestionGroups(QuestionGroupDB questionGroups) {
this.questionGroups = questionGroups;
}
}
ated by usuario on 14/7/14.
*/
public class ReplieTypeDB extends RealmObject {
private int idReplieType;
private String name;
public ReplieTypeDB(int idReplieType, String name) {
super();
this.idReplieType = idReplieType;
this.name = name;
}
public ReplieTypeDB() {
super();
}
public int getIdReplieType() {
return idReplieType;
}
public void setIdReplieType(int idReplieType) {
this.idReplieType = idReplieType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class ReplieDB extends RealmObject {
private QuestionDB question;
private String reply;
private int replieId;
public ReplieDB() {
super();
}
public ReplieDB(QuestionDB question, String reply, int replieId) {
this.question = question;
if (reply != null)
this.reply = reply;
else
this.reply = "";
this.replieId = replieId;
}
public QuestionDB getQuestion() {
return question;
}
public void setQuestion(QuestionDB question) {
this.question = question;
}
public String getReply() {
return reply;
}
public void setReply(String reply) {
this.reply = reply;
}
public int getReplieId() {
return replieId;
}
public void setReplieId(int replieId) {
this.replieId = replieId;
}
}
public class QuestionsInReplieDB extends RealmObject {
private int idQuestionGroup;
private String nameReport;
private RealmList<QuestionDB> questionDBs;
private int times;
public QuestionsInReplieDB(int idQuestionGroup, String nameReport, RealmList<QuestionDB> questionDBs, int times) {
super();
this.idQuestionGroup = idQuestionGroup;
this.nameReport = nameReport;
this.questionDBs = questionDBs;
this.times = times;
}
public QuestionsInReplieDB() {
super();
}
public int getIdQuestionGroup() {
return idQuestionGroup;
}
public void setIdQuestionGroup(int idQuestionGroup) {
this.idQuestionGroup = idQuestionGroup;
}
public String getNameReport() {
return nameReport;
}
public void setNameReport(String nameReport) {
this.nameReport = nameReport;
}
public List<QuestionDB> getQuestionDBs() {
return questionDBs;
}
public void setQuestionDBs(RealmList<QuestionDB> questionDBs) {
this.questionDBs = questionDBs;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
}
public class QuestionGroupDB extends RealmObject {
private int idQuestionGroupInReplie;
private String nameQuestionGroupInReplie;
private RealmList<QuestionDB> questions;
private int times;
public QuestionGroupDB() {
}
public int getIdQuestionGroupInReplie() {
return idQuestionGroupInReplie;
}
public void setIdQuestionGroupInReplie(int idQuestionGroupInReplie) {
this.idQuestionGroupInReplie = idQuestionGroupInReplie;
}
public String getNameQuestionGroupInReplie() {
return nameQuestionGroupInReplie;
}
public void setNameQuestionGroupInReplie(String nameQuestionGroupInReplie) {
this.nameQuestionGroupInReplie = nameQuestionGroupInReplie;
}
public List<QuestionDB> getQuestions() {
return questions;
}
public void setQuestions(RealmList<QuestionDB> questions) {
this.questions = questions;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
}
public class QuestionDB extends RealmObject{
public QuestionDB() {
}
private int idQuestion;
private String question;
private int order;
private ReplieTypeDB replieType;
public int getIdQuestion() {
return idQuestion;
}
public void setIdQuestion(int idQuestion) {
this.idQuestion = idQuestion;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public ReplieTypeDB getReplieType() {
return replieType;
}
public void setReplieType(ReplieTypeDB replieType) {
this.replieType = replieType;
}
}
RealmList可以用类型进行推测,我没有在photoList中使用它。