Updated response:
Currently i only know that:
- It's not a Travis-ci issue because I reproduced it locally on a linux
machine.
- It's not related to R package, it's the default package and the import is unnecessary.
- It's not related to the appcompat error, build is successful with any random change.
- Seems something related to incremental builds, see this, also this and try to set it to false.
Story: Don't compile a source file when the API of its compile
dependencies has not changed
Currently, changing the body of a method invalidates all class files
that have been compiled against the method's class. Instead, only the
method's class should be recompiled. Similarly, changing a resource
file invalidates all class files that included that resource file in
the compile classpath. Instead, resource files should be ignored when
compiling.
We don't necessarily need a full incremental Java compilation to
improve this. For example, the Java compilation task may consider the
API of the compile classpath - if it has changed, then compile all
source files, and if it has not, skip the task (assuming everything
else is up to date). This means that a change to a method body does
not propagate through the dependency graph.
Stracktrace error on first build (second build successful):
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':examples:app:compileReleaseJavaWithJavac'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
...
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:48)
Perhaps this warning, Java8 or annotations are related. I hope this helped, I leave because any change I do, makes the build successful and it's hard to understand the real issue.
I configured Java 8 usage like this:
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Previous response:
Try to add to your MainActivity.java
the next import using your real package:
import your.package.R;
R file is not correctly generated due to previous errors like this:
COMPILE-Error: package android.support.v7.app does not exist
I just tested it. I downloaded your project on a linux machine (it's not a travis-ci issue).
I replaced the dependency by the next line and it works:
compile "com.android.support:appcompat-v7:25.0.0"
So I suggest you to add { }
:
compile "com.android.support:appcompat-v7:${project.supportLibVersion}"
Really, I'm not sure, now it's working always without the suggested changes.
Perhaps, it's true that it's about parallel option issue and worked on second run, but we are close.