I was trying to build my project again after installing the latest preview version of android studio, but follow exception is showing on updating the gradle version:
The issue comes from how compileJjtree is configured more specifically the value used for inputDirectory 19. The value is set to projectDir which ends up been passed 11 to the SourceTask.setSource 2. By default, any SourceSet related configuration in Gradle will grab everything recursively under the source directory specified. In most case, this is fine as the folder is deep and isolated in the project’s folder layout. Once in awhile, more often with legacy folder structure, the configuration requires the source directory to be closer to the project root folder. In those case, a lot more files could be included and, often but not always, those files are specified as input to a task. Gradle will honor those input by creating a snapshot for future execution run. In that scenario, two problems will occur.
Input snapshot will fail. Just like your current failure, the task will try to snapshot files that are unrelated to the task’s job. Those files could be system files or legitimately locked by another process.
Input snapshot will succeed but the task will never be up-to-date. A folder could be included in the snapshot that happens to be the output of another task that runs before (or after) your task. This will cause Gradle to wrongly detect a change for a task as some of the “input” are changed between runs. This will kind of happen in your case as the compileJjtree will snapshot the build folder which changes as more task are run.
That been said, to fix your problem, you will have to narrow down the amount of files included in compileJjtree through include and exclude methods from SourceTask . If the filtering pattern becomes too complicated, you can always move the inputDirectory somewhere more isolated and let Gradle glob everything.
Reducing the scope of the compileJjtree task solves the problem.
it reads ...
ModuleVersionNotFoundException: Could not find com.android.tools.build:aapt2:3.2.0-alpha18-4804415.
you might require Gradle >= 4.10
for com.android.tools.build:gradle
3.3.0
(or at least a later version, than what you have now, for 3.2.0-alpha18
).
this can be changed in gradle-wrapper.properties
:
distributionUrl = https\://services.gradle.org/distributions/gradle-4.4-all.zip
Go Settings/Gradle/Android Studio. Then check "Enable embedded Maven repository". And you're good to go.
Sync Project with gradle files worked for me.
In my case it fixed by adding:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 // <= add this
targetCompatibility JavaVersion.VERSION_1_8 // <= add this
}
}
to android/app/build.gradle file
Was having this issue since my network couldn't connect to Maven repository. Changing my network settings did the job