Status Update
Comments
uc...@google.com <uc...@google.com>
ar...@google.com <ar...@google.com> #2
Hi, was this a regression after you upgrade your NDK or upgrade your Android Studio?
ga...@google.com <ga...@google.com> #3
Neither of them. There were no change to AS (4.1-RC1) nor NDK versions.
I just changed my old scripts in build.gradle to the android recommended method i.e.
externalNativeBuild { ndkBuild { path file('jni/Android.mk') } }
If I reverted the change to my old script, everything is working again. The old scripts uses
ndk.dir=/opt/android/android-sdk/ndk-bundle
as defined in local.properties file
The source.properties files indicate the version as:
Pkg.Desc = Android NDK Pkg.Revision = 21.3.6528147
am...@bam-boo.eu <am...@bam-boo.eu> #4
Hi, the problem is that when Android Gradle Plugin executes ndk-build, it is missing the '-C' + projectDir + '/jni'
part in your custom task. Therefore, the current working directory is the module root (parent of the jni
directory). Hence the error.
The fix is to add the following to your build.gradle
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
}
Please reopen the bug if you have further issues. Thanks!
ga...@google.com <ga...@google.com> #5
Please provide the full syntax for the externalNativeBuild scripts. gradle sync throws the following error message when I added the recommended argument statement to the script (or change to arguments('-Cjni'))
A problem occurred evaluating project ':aTalk'.
No signature of method: build_6xrerbyg3j4aatiomvrbavr6i.android() is applicable for argument types: (build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4) values: [build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4@497bb461]
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
arguments "-Cjni"
}
}
am...@bam-boo.eu <am...@bam-boo.eu> #6
There are actually two different types of exteranlNativeBuild
blocks. The block in #4 needs to be put inside defaultConfig
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
...
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
}
ga...@google.com <ga...@google.com> #7
But seeing the following errors not found in old method.
a. user now has to define what ABI to build for the adb debug; previously no such option and it is auto selected.
b. During run, it opens up a file (org_atalk_impl_neomedia_device_OpenSLESSystem.c) and indicates:
This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project.
and the whole debug aborted with signel= SIGABRT (signal SIGABRT). and Note10 went black.
but the file already specified in the included file jni/opensles/Android.mk
# ========== OpenSLES (jnopensles.so library) ==================
### OpenSLES shared library build
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lOpenSLES -llog
LOCAL_MODULE := jnopensles
LOCAL_SRC_FILES := \
org_atalk_impl_neomedia_device_OpenSLESSystem.c \
org_atalk_impl_neomedia_jmfext_media_protocol_opensles_DataSource.c \
org_atalk_impl_neomedia_jmfext_media_renderer_audio_OpenSLESRenderer.c
include $(BUILD_SHARED_LIBRARY)
However I realized that the new method perform the ndkBuild for every aTalk build variant (x4).
How do I make ndkBuild build only once for all the variants?
Moving the jni subDirectory into the ./src/main/jni does not seem to resolve the 4x build problem; but created other problems e.g.
a. Still proceed to build 4 times for the aTalk Build Variants.
b. Fail to perform adb install with the following error message (actual apk did contain the required ABI lib):
08/15 10:33:41: Launching 'aTalk' on samsung SM-N975F.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_NO_MATCHING_ABIS
List of apks:
[0] '/home/cmeng/workspace/android/atalk-android/aTalk/build/outputs/apk/playstore/debug/aTalk-playstore-debug.apk'
Installation failed due to: 'null'
Retry
am...@bam-boo.eu <am...@bam-boo.eu> #8
Hi, you can filter ABIs with
Can you share the project with your changes on build.gradle?
ga...@google.com <ga...@google.com> #9
You can download aTalk project sources from
ABIs with abiFilters is only for ABI variants; aTalk has already specified this in jni/Application.mk.
The shortfall in my earlier comment is externalNativeBuild{} will proceed to build the filtered ABI's for every aTalk built variants e.g. fdroid.release, fdroid.debug, playstore.release, playstore.release; 4 times when aTalk perform aTalk | Tasks | build | build selected from the Gradle ToolBar
am...@bam-boo.eu <am...@bam-boo.eu> #10
It's a current limitation that native builds cannot be shared across different variants. We are aware of this and would like to improve the situation. For now you may be able to workaround the problem by moving the native code into a separate module with a single variant and make the main module depending on it.
Could you elaborate what you mean by "a. user now has to define what ABI to build for the adb debug; previously no such option and it is auto selected."? What was your workflow for debugging? After using externalNativeBuild
, how exactly do you define the ABI to build?
Regarding app crash after deployment, do you have the same problem with the Android emulator?
ga...@google.com <ga...@google.com> #11
In old jni method, the ABI selection is automatically defined by AS pending on targeted device for debug.
Does this mean, using the externalNativeBuild{} method. user now has to decide which ABI to use pending on targeted device for debug.
Is there a need for such option, as the release build will have to include all the ABI's native libraries?
am...@bam-boo.eu <am...@bam-boo.eu> #12
This option is for the code editor (for example ABI-specific macro expansion). It won't affect deployment. When you deploy to a device, the right ABI would be built regardless of what you select in the "Build Variant" window. Is this not the behavior you have seen?
ga...@google.com <ga...@google.com> #13
For my debug test, like all other build variant options, I always ensure that I selected the ABI for my targeted device.
I did not verify if the debug apk contains the correct ABI native library if I have selected other instead.
am...@bam-boo.eu <am...@bam-boo.eu> #14
see
This morning I tried again using android recommend method to build aTalk jni; and with the latest upgraded development environment i.e.:
============
Build: AI-201.8743.12.41.6953283, 202011050241,
AI-201.8743.12.41.6953283, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Linux(amd64) v5.4.0-54-generic, screens 3840x2160
AS: 4.1.1; Kotlin plugin: 1.4.21-release-Studio4.1-1; Android Gradle Plugin: 4.1.1; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: LLDB 3.1 (revision: 3.1.4508709); CMake: from local.properties: (not specified), latest from SDK: 3.10.2, from PATH: (not found)
============
But I am still facing the same problem as reported earlier i.e.
============
b. During adb install/run, it opens up a file (org_atalk_impl_neomedia_device_OpenSLESSystem.c) and indicates:
This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project.
and the whole debug aborted with Note10 hangs in splash screen.
2020-12-15 09:11:39.668 16720-21903/
but the file already specified in the included file jni/opensles/Android.mk i.e.
# ========== OpenSLES (jnopensles.so library) ==================
### OpenSLES shared library build
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lOpenSLES -llog
LOCAL_MODULE := jnopensles
LOCAL_SRC_FILES := \
org_atalk_impl_neomedia_device_OpenSLESSystem.c \
org_atalk_impl_neomedia_jmfext_media_protocol_opensles_DataSource.c \
org_atalk_impl_neomedia_jmfext_media_renderer_audio_OpenSLESRenderer.c
include $(BUILD_SHARED_LIBRARY)
===========
Please advice how can I resolve the above problem so aTalk can proceed to migrate to the latest AS recommended method for jni build.
I also tested with AVD PIXEL-2_API-28, it too is facing the exact same problem.
If you need to verify the problem, please download the source from aTalk github repository:
then replace the file atalk project build.gradle with the attached file below:
am...@bam-boo.eu <am...@bam-boo.eu> #15
The problem seems to come from the android studio when doing "debug build" or the debugger. If I just build and install a release version (without the debug info), then the apk works without the problem.
ga...@google.com <ga...@google.com> #16
Without some background and familiarity with this project, it's difficult for me to understand why the app crashes. From logcat, it appears the assertion at line 74 in <project>\aTalk\jni\opensles\org_atalk_impl_neomedia_device_OpenSLESSystem.c
failed (I appended && 1
, && 2
, && 3
, etc to each assertion expression and found this out). I have never used OpenSLES. Maybe it's better to ask on stackoverflow.
am...@bam-boo.eu <am...@bam-boo.eu> #17
1. The assertion exception as you have mentioned. What I see is that this only happens when the jni source is complied for DEBUG. When I run aTalk debug version as it, i.e. without the debugger attached; it throws the following exception as shown in the logcat. aTalk crashes on startup, and OS shows "aTalk keeps stopping" every time aTalk is launched.
Your team needs to understand why the assertion crashes the system when the jni source is compiled for debug, but not in release version.
However if I build aTalk release version, there is not such exception. Look like the exception is introduced by the debug version build process.
As a patch to the first problem, I comment out the assertion statement. this eliminate the assertion exception from occurring. aTalk can still work without this assertion statement, as shown in the logcat info.
I/OpenSLES: Create Audio Engine
I/OpenSLES: Realize Audio Engine; engineObject_: 0x723c799c00
W/libOpenSLES: Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED)
E/OpenSLES: Failed: Query Audio Input Capabilities
2. "This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project".
The above is thrown by the debugger when the assertion occur. Look like the debugger is unable to link the source to the project, even though it is defined in the Android.mk.
Any proposed solution to resolve this second problem?
========= Assertion exception =========
2020-12-16 08:04:59.191 12018-12899/
2020-12-16 08:04:59.246 12923-12923/? A/DEBUG: pid: 12018, tid: 12899, name: k.AsyncExecutor >>>
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #02 pc 0000000000001694 /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/lib/arm64/libjnopensles.so (Java_org_atalk_impl_neomedia_device_OpenSLESSystem_queryAudioInputCapabilities+456) (BuildId: 568eb5ff8fbe900b4e2eab8356b76a3b53fbd207)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #10 pc 0000000000292f14 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.OpenSLESSystem.doInitialize+32)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #13 pc 000000000028f514 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initialize+8)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #16 pc 000000000028fa16 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize+14)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #19 pc 000000000028f9ee [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize+2)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #22 pc 000000000028f4d2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.<init>+58)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #25 pc 000000000028d9b4 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.AudioSystem.<init>+4)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #28 pc 000000000028d996 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.AudioSystem.<init>+2)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #31 pc 0000000000292edc [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.OpenSLESSystem.<init>+4)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #45 pc 000000000028f6d2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+254)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #48 pc 000000000028f9c4 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+392)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #51 pc 000000000028f594 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+36)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #57 pc 000000000028e858 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceConfiguration.<init>+60)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #60 pc 000000000022df92 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.MediaServiceImpl.<init>+10)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #74 pc 000000000022b9be [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl$ServiceLock.initializeService+114)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #77 pc 000000000022b906 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl$ServiceLock.getService+38)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #80 pc 000000000022bb00 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl.getService+60)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #83 pc 00000000002dca2c [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.service.libjitsi.LibJitsi.invokeGetServiceOnImpl+8)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #86 pc 00000000002dcb5c [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.service.libjitsi.LibJitsi.getMediaService+4)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #89 pc 0000000000234cd6 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.NeomediaActivator.start+14)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #92 pc 00000000002d3308 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.BundleImpl.start+220)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #95 pc 00000000002d48f6 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.launch.FrameworkImpl.startLevelChanged+78)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #98 pc 00000000002d4ca2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.startlevel.FrameworkStartLevelImpl$Command.run+90)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #101 pc 00000000002d280a [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor.runInThread+154)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #104 pc 00000000002d2728 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor.access$000)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #107 pc 00000000002d21da [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor$1.run+6)
ga...@google.com <ga...@google.com> #18
Thanks! Problem #2 is a bug in AGP and we will fix it in future releases.
am...@bam-boo.eu <am...@bam-boo.eu> #19
Here's the log of updated JacocoTaskDelegate (slightly redacted, quickly recorded right now, will provide diff later, forgot to record it)
> Task :app:jacocoJaguarDefaultMarketDebug
Task :app:jacocoJaguarDefaultMarketDebug in app Starting
Build cache key for task ':app:jacocoJaguarDefaultMarketDebug' is f56b624293460efdadba067dfe542182
Task ':app:jacocoJaguarDefaultMarketDebug' is not up-to-date because:
Input property 'inputClasses' file /Users/fobo66/StudioProjects/JLRICRAndroid-Redev/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/jaguarDefaultMarketDebug/R.jar has changed.
Input property 'inputClasses' file /Users/fobo66/StudioProjects/JLRICRAndroid-Redev/app/build/intermediates/javac/jaguarDefaultMarketDebug/classes/com/jlr/jaguar/analytics/Event$Action.class has changed.
Input property 'inputClasses' file /Users/fobo66/StudioProjects/JLRICRAndroid-Redev/app/build/intermediates/javac/jaguarDefaultMarketDebug/classes/com/jlr/jaguar/analytics/Event$Category.class has changed.
1) Step 1 in [ms]: 5
2) Out of date done in [ms]: 12
3) Removed done in [ms]: 18
AAPT2 aapt2-4.0.1-6197926-osx Daemon #0: shutdown
AAPT2 aapt2-4.0.1-6197926-osx Daemon #1: shutdown
AAPT2 aapt2-4.0.1-6197926-osx Daemon #2: shutdown
AAPT2 aapt2-4.0.1-6197926-osx Daemon #3: shutdown
> Task :app:jacocoJaguarDefaultMarketDebug
Processing incrementally took [ms]: 228660
...
Stored cache entry for task ':app:jacocoJaguarDefaultMarketDebug' with cache key f56b624293460efdadba067dfe542182
Task :app:jacocoJaguarDefaultMarketDebug in app Finished
:app:jacocoJaguarDefaultMarketDebug (Thread[Execution worker for ':' Thread 11,5,main]) completed. Took 3 mins 53.87 secs.
:app:dexBuilderJaguarDefaultMarketDebug (Thread[Execution worker for ':' Thread 11,5,main]) started.
am...@bam-boo.eu <am...@bam-boo.eu> #20
Here's the diff:
Common subdirectories: jaguarDefaultMarketDebug/META-INF and jaguarDefaultMarketDebug2/META-INF
Common subdirectories: jaguarDefaultMarketDebug/com and jaguarDefaultMarketDebug2/com
There are a lot of files inside, but it seems that they're identical
am...@bam-boo.eu <am...@bam-boo.eu> #21
I've added extra logs and found out that this code appears to be the issue (JacocoTaskDelegate.java line 209):
// remove old output
for (Path basePath : basePathToRemove.keys()) {
for (Path toRemove : basePathToRemove.get(basePath)) {
Action action = calculateAction(toRemove.toFile(), basePath.toFile());
if (action == Action.IGNORE) {
continue;
}
Path outputPath =
getOutputPath(basePath, toRemove, output.get().getAsFile().toPath());
PathUtils.deleteRecursivelyIfExists(outputPath);
}
}
System.err.println("4) Removed old output done in [ms]: " + (System.currentTimeMillis() - start));
Here's the log:
...
4) Removed old output done in [ms]: 201628
Processing incrementally took [ms]: 201693
...
ga...@google.com <ga...@google.com> #22
Only removed/modified paths should be removed, and I'd expect to have only a handful of those. Can you add some more logging in that loop e.g printing all basePath
values in the outer loop and all toRemove
in the inner loop?
am...@bam-boo.eu <am...@bam-boo.eu> #23
Looks like it tries to remove anything inside app/build/tmp/kotlin-classes/jaguarDefaultMarketDebug. My Studio hanged when I've added extra logs, so I'll try to dig daemon logs if they are available, maybe there's more paths
am...@bam-boo.eu <am...@bam-boo.eu> #24
Well, daemon logs stopped when still processing kotlin-classes because daemon was killed by me. Log file was 2.5 GB.
ga...@google.com <ga...@google.com> #25
It seems that kotlin incremental compilation produces completely different outputs in the 1st and in the 2nd build, but then I find it strange that in
If all Kotlin sources are being re-processed, I think that might explain why it takes so long. For each modified path:
- AGP is using RegExp to figure out if it needs to copy/ignore/instrument that class file (should be cheap)
- AGP computes output location for that file (should be cheap)
- AGP deletes output location and all subdirectories (this can be costly)
And this difference seems to extend to Java classes as well. In the deamon log from #17, for the jacoco task that took 4 mins 13.872 secs
, I can see:
- 1543 instrumented Java classes
- 2516 instrumented Kotlin classes
How many classes there are in total if you count all class files under app/build/tmp/kotlin-classes/jaguarDefaultMarketDebug/
and app/build/intermediates/javac/jaguarDefaultMarketDebug
? It could be that the changed files actually inline R.jar constants that change between builds.
Also, can you test my hypothesis that output deletion takes a bunch of time by commenting it out? It may produce incorrect output, but it is useful as a way to test the hypothesis.
am...@bam-boo.eu <am...@bam-boo.eu> #26
As far as I can see, not all Kotlin classes were using R.jar constants, but classpath for Kotlin compile task was changed, thus causing it to full rebuild:
Task ':app:compileJaguarDefaultMarketDebugKotlin' is not up-to-date because:
Class path of task ':app:compileJaguarDefaultMarketDebugKotlin' has changed from 05dc8665ddde555057e95b579121aa9a to 15effd282854557decb2b289286f94b8.
The input changes require a full rebuild for incremental task ':app:compileJaguarDefaultMarketDebugKotlin'.
There were roughly 2,679 class files
Also, with removed output deletion it worked fine in 5 seconds, it wasn't stuck, and I will check coverage reports as soon as they complete
ga...@google.com <ga...@google.com> #27
I've managed to reproduce the issue, and it turns out the root cause is the same as keys
on multimap instead of keySet()
method, causing each entry to be processed multiple times. We'd execute that loop N^2 times where N is the number of changed files.
This has been fixed already in AGP 4.2. I'll cherry-pick a fix to 4.1 branch.
ga...@google.com <ga...@google.com> #28
This will be fixed in the Android Gradle plugin 4.1.2. Change I7ce00c5a63a737e7c59f27b5c962a6d2d30d2f41.
Description
Build: AI-193.6911.18.40.6626763, 202006250242,
AI-193.6911.18.40.6626763, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.15.6, screens 2560x1440, 1680x1050
AS: 4.0.1; Kotlin plugin: 1.4.0-release-Studio4.0-1; Android Gradle Plugin: 4.0.1; Gradle: 6.5.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
We use AGP's JaCoCo for coverage reports that is set for debug builds. Sometimes
jacoco
task takes a lot of time, from 5 to 16 minutes. Most of this time it seems to wait for lock release. It can happen after switching flavors in Studio, but it doesn't seem to be the cause.These are the strings that are repeatedly shown in the log (it's extremely hard to get actual log of the issue):
jacoco
task becomes stuck rarely, but sometimes it can even get stuck repeatedly. It seems to be random, but there is something that doesn't release lock in time, makingjacoco
task stuck.Before
jacoco
task,mergeResources
task is executed.