Status Update
Comments
al...@gmail.com <al...@gmail.com> #2
Lint options:
lintOptions {
lintConfig = file('lint.xml')
abortOnError true
xmlReport true
htmlReport true
checkDependencies true
}
Also, our project has custom lint rules. Failure happens with a dependency of 26.6.3 and 27.0.0.
Is any way to downgrade lint runner? This problem is keeping us from using AGP 4.0
pi...@gmail.com <pi...@gmail.com> #3
Attached slightly different stacktrace for the same problem.
Wonder if disabling some lint rules could help to "fix" this problem, as it is also blocking for us 4.0 AGP upgrade.
hu...@google.com <hu...@google.com>
m4...@gmail.com <m4...@gmail.com> #4
Notes:
I suspect the exceptions are happening now because JetBrains recently changed an assert
statement into a hard failure (see
I.e., it's possible that Lint has been hitting this code path all along, and only now it is causing a problem.
This has been difficult to investigate so far because the failure is nondeterministic and also deep inside the Kotlin compiler. Plus, JetBrains seems to be hitting this code path occasionally too (hence why they changed the assert into a hard failure), so I'm not even sure whether Lint is implicated or not.
ch...@gmail.com <ch...@gmail.com> #5
It could also explain why not all lint rules were working from time to time (
Is any public issue created I could follow?
si...@gmail.com <si...@gmail.com> #6
Has anyone tried this with 4.1.0-beta2? We're using a more recent version of UAST and the Kotlin compiler there. It's not clear that it's fixed but -- there's a chance :-)
lf...@google.com <lf...@google.com> #7
I tried. The same error. I am wondering, is any way to know which lint checks cause failure? I have a few custom lint checks. Or, is any way downgrade compiler for lint checks?
lf...@google.com <lf...@google.com> #8
I did more tests and probably narrow down a cause. I did all tests on 4.1.0-beta2
. Original configuration have enabled checkDependencies
and included custom lint checks. Custom lint checks are compiled using 26.6.3
version:
checkDependencies = true, customLintChecks = true
= 20% chance of successcheckDependencies = true, customLintChecks = false
= 57% chance of successcheckDependencies = false, customLintChecks = true
= 100% chance of success
It is a clear evidence that checkDependencies
feature is not stable. In addition, custom lint checks is not friendly with checkDependencies
and increases the risk of failure. Or maybe just an old lint SDK used is to blame.
It is very similar to
I have a theory, but do not know how to test. Maybe crashes happening because there are some lint checks from libs built upon old lint SDK version?
ma...@gmail.com <ma...@gmail.com> #9
To me this is happening on 4.2.0-alpha04 too.
Can someone confirm that this is happening if you have these three conditions met?:
- checkDependencies=true on your app module
- have a custom lint rule using lintChecks on your app module
- have a custom lint rule using lintChecks on your library module
For me the error went away after I removed the lintChecks on the library module.
jo...@gtempaccount.com <jo...@gtempaccount.com> #10
could you clarify exactly what you mean in these?
have a custom lint rule using lintChecks on your app module have a custom lint rule using lintChecks on your library module
By this I mean a declaration in your modules dependency block:
lintChecks project(":features:language_lint")
hs...@google.com <hs...@google.com> #11
As opposed to lintPublish
? Or is that not relevant?
ra...@gmail.com <ra...@gmail.com> #12
For me this is for local checks so I'm using lintChecks. Removing lintChecks from the library module and only applying it on the app module fixed the lint crash. However that's not optimal as I want to run the lint checks individually on the library module as well. It would not be interesting if this is really the cause of the issue or if it doesn't fix it for others.
lf...@google.com <lf...@google.com> #13
I do not have any custom lint checks declared but there might be a transient lint check pulled in.
ch...@gmail.com <ch...@gmail.com> #14
We have checkDependencies=true
on our app module and apply there custom lint checks. Disabling custom lint checks has not solved the issue, though we have more custom lint checks via external dependencies (for example, timber).
[Deleted User] <[Deleted User]> #15
#14, could you check with checkDependencies=false
? It fixes problem on my project. Would be nice to hear more proves.
ra...@gmail.com <ra...@gmail.com> #16
#15, I've set checkDependencies = false
, but left our custom lint checks enabled. So far lint finished successfully without issue errors.
lf...@google.com <lf...@google.com> #17
In my case, all builds of the >50 were a success after checkDependencies = false
. However, disabling checkDependencies
is not a solution as well. Since all our code is split in small logical modules, there is no point in lint. Too many false-positives and true-negatives.
[Deleted User] <[Deleted User]> #18
I cherry-picked a change to 4.1 Beta 4 which essentially changes this error into a logged warning rather than a hard failure. That does not "fix" the problem, but it at least gets us back to the behavior of 3.6. Can someone confirm that this workaround has worked for them?
Also, I think I know what the root cause is (see notes below). However, it's hard to be sure without a repro scenario. Would anyone be willing to share an open-source project that reproduces this bug? (You can also send the project to
Notes:
-
My current theory is that this bug is related to
.https://issuetracker.google.com/159733104#comment6
I.e., I think Lint should not be reusing the same Kotlin compiler environment to analyze multiple modules, which is what we do whencheckDependencies=true
. -
It is still strange that the failure is nondeterministic. However, one potential reason is that the Kotlin compiler caches many things via
SoftReference
.
lf...@google.com <lf...@google.com> #19
Sorry for my long delay. I was tried with 4.1.0-beta05
(newest version to date), and the problem is still here. I added new log in case lines were changed.
Would anyone be willing to share an open-source project that reproduces this bug?
I have only closed source project with this problem. Maybe someone knows some quite large multimodule opensource project I could try setup AGP with lint and try reproduction?
hs...@google.com <hs...@google.com> #20
I tried to reproduce with two small multimodule projects, but all builds works flawlessly. Also, I tried to reproduce using checkDependencies
, and 6 other helper modules. 145k CLOC without tests. I suppose there is a good chance problem happen due to the cache.
It is still strange that the failure is nondeterministic.
It is even non-deterministic in CI/docker builds using the same fresh environment and exactly the same code each time. Build cache and daemon is disabled there. Multithreading should be involved as well.
In addition, I found in most cases failed due to the same file
hs...@google.com <hs...@google.com> #21
ra...@gmail.com <ra...@gmail.com> #22
There are some architectural changes coming in Lint that will fix this properly, but they will not make it into 4.2.
However, there is another workaround you can try that will be available starting in AGP 4.2 Beta 4.
Essentially you can tell Lint to "reset" the Kotlin compiler between each module analysis, thereby clearing all caches. I did not make this the default behavior because the effect on performance is unknown/risky.
To enable this behavior, either set the environment variable LINT_DO_NOT_REUSE_UAST_ENV
to "true", or set the JVM system property lint.do.not.reuse.uast.env
to "true". For example, you can do this from the command line:
./gradlew -Dlint.do.not.reuse.uast.env=true :app:lintDebug
Or by putting this in your gradle.properties
file:
systemProp.lint.do.not.reuse.uast.env=true
[Deleted User] <[Deleted User]> #23
Status updates:
-
I'm still hoping someone can confirm whether the workaround in
worked for them in AGP 4.2.comment#22 -
Starting with AGP 7.0-alpha13 the root cause of this issue should be fixed completely due to the new "partial analysis" mode (enabled by default) in which Lint analyzes modules independently and merges results along the way. It fixes the issue because Lint will no longer use the same Kotlin compiler environment to analyze multiple modules (and so the risk of stale caches is gone).
ra...@gmail.com <ra...@gmail.com> #24
I'm still hoping someone can confirm whether the workaround in
worked for them in AGP 4.2. comment#22
This unfortunately did not work for us. We actually see lint crashes after enabling via systemProp.lint.do.not.reuse.uast.env=true
. See the attached log. It's also much slower, as expected.
AGP 4.2 seems to make this error much more frequent compared to 4.1, for some reason.
ra...@gmail.com <ra...@gmail.com> #25
Can you file a new bug? You can add a comment here linking to it.
[Deleted User] <[Deleted User]> #26
Sure. Without that workaround, we get the same
ERROR: package fragment is not found for module:<lint-module> is a module[ModuleDescriptorImpl@5e5e6c61] file:KtFile: LiveViewerViewData.kt
error in this ticket occasionally (1-2% of the time?).
hs...@google.com <hs...@google.com> #27
Oh, I misunderstood. So, using lint.do.not.reuse.uast.env
is what causes the new crash? That is unfortunate, and I will investigate. Let me know if there is a sample project you can share that reproduces the issue.
[Deleted User] <[Deleted User]> #28
Not sure if you still wanted the new bug, but here it is:
hs...@google.com <hs...@google.com> #29
FYI the issue in
And to confirm, lint.do.not.reuse.uast.env
should no longer be needed at all in AGP 7.0+.
hs...@google.com <hs...@google.com> #30
Thanks #29 . I am noticing that when this happens, after the error log for
package fragment is not found for module:<lintWithKotlin> is a module
There is another error
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'descriptor' of org/jetbrains/kotlin/codegen/context/CodegenContext.intoPackagePart must not be null
at org.jetbrains.kotlin.codegen.context.CodegenContext.$$$reportNull$$$0(CodegenContext.java)
at org.jetbrains.kotlin.codegen.context.CodegenContext.intoPackagePart(CodegenContext.java)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1$1.invoke(LightClassDataProvider.kt:51)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1$1.invoke(LightClassDataProvider.kt:38)
at org.jetbrains.kotlin.asJava.builder.LightClassBuilderKt.buildLightClass(LightClassBuilder.kt:64)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1.invoke(LightClassDataProvider.kt:47)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1.invoke(LightClassDataProvider.kt:38)
at org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport.createDataHolderForClass(CliLightClassGenerationSupport.kt:64)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject.computeLightClassData(LightClassDataProvider.kt:45)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject.compute(LightClassDataProvider.kt:61)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:72)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at
Does the fix address both of these?
st...@gmail.com <st...@gmail.com> #31
package fragment is not found
and Argument for @NotNull parameter...
), the workaround in 4.2 is to put
systemProp.lint.do.not.reuse.uast.env=true
in your gradle.properties
file as described in
hu...@google.com <hu...@google.com>
[Deleted User] <[Deleted User]> #32
Marking fixed in AGP 7.0.
That is, the lint.do.not.reuse.uast.env
workaround should no longer be needed in AGP 7.0+. And, you should no longer see the following warnings/errors while running Lint:
ERROR: package fragment is not found for module:<lintWithKotlin>...
ERROR: Could not generate LightClass for...
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'descriptor' of org/jetbrains/kotlin/codegen/context/CodegenContext.intoPackagePart must not be null
The issue is fixed due to the new "Lint partial analysis" mode (enabled by default) which creates a standalone UastEnvironment
instance for each module, thereby avoiding stale caches in the Kotlin compiler frontend.
Please comment on the bug if you see any similar errors in AGP 7.0+.
mi...@gmail.com <mi...@gmail.com> #33
fi...@gmail.com <fi...@gmail.com> #35
[Deleted User] <[Deleted User]> #38
I try to this blog but, i hav a problem.
input the "sudo kextload -bundle-id com.intel.kext.intelhaxm"
after this message.
"com.intel.kext.intelhaxm failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8)."
i need your help. plz.
sr...@gmail.com <sr...@gmail.com> #39
lf...@google.com <lf...@google.com> #40
That's likely because HAXM wasn't installed yet. You can check if it is installed by issuing
$ kextstat | grep haxm
145 0 0xffffff7f832d6000 0x1c000 0x1c000 com.intel.kext.intelhaxm (6.2.0) FAD2A80C-AB2D-351F-9314-04E1DEB2F004 <7 5 4 3 1>
and seeing if a line similar to that shows up.
You may also use Hypervisor.Framework if your macOS supports:
$ sysctl kern.hv_support
kern.hv_support: 1
and you use a 32-bit x86 image. (and add "HVF = on" in ~/.android/advancedFeatures.ini (create if it doesn't exist))
sr...@gmail.com <sr...@gmail.com> #41
js...@gmail.com <js...@gmail.com> #42
Starting emulator for AVD 'NExus5_API_25'
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine (/dev/HAX is missing).
I installed HAXM through the DMG and the silent_install.sh. Here's the log of the silent install:
/dev/disk4 GUID_partition_scheme
/dev/disk4s1 Apple_HFS /Volumes/com_intel_kext_haxm_disc
mpkg_file=/Volumes/com_intel_kext_haxm_disc//IntelHAXM_6.2.1.mpkg
ecx 7ffafbff
edx 2c100800
edx 2c100800
No emulator instance exist!
sed: /Library/Extensions/intelhaxm.kext/Contents/Resources/support.txt: No such file or directory
Intel HAXM: This is a new installation
installer: Package name is Intel(R) Hardware Accelerated Execution Manager
installer: Upgrading at base path /
installer: The upgrade was successful.
"disk4" unmounted.
"disk4" ejected.
HAXM silent installation finished!
*************** Silent installation Pass ! ****************
Running "sudo ./silent_install.sh -v" returns "6.2.1".
Running "sudo ./silent_install.sh -c" returns "VT support -- Yes, NX support -- Yes."
Running "sudo kextload -bundle-id com.intel.kext.intelhaxm" returns:
"com.intel.kext.intelhaxm failed to load - (libkern/kext) system policy prevents loading; check the system/kernel logs for errors or try kextutil(8)."
Do I still have to disable the Security Protection on kext first?
js...@gmail.com <js...@gmail.com> #44
[Deleted User] <[Deleted User]> #45
[Deleted User] <[Deleted User]> #46
sa...@gmail.com <sa...@gmail.com> #47
Thanks.
el...@gmail.com <el...@gmail.com> #48
su...@suyashjoshi.com <su...@suyashjoshi.com> #49
[Deleted User] <[Deleted User]> #50
For step-by-step instructions, please refer to the following links for now. These are for other software products that also install a KEXT, and thus have the same problem on macOS High Sierra. The only thing that will appear different from their screenshots is the developer name, which is "Intel Corporation Apps" for HAXM:
(Symantec Endpoint Protection)
(ESET Endpoint Security)
Although we could improve the emulator error message, it's impossible for HAXM to unblock its own KEXT automatically, so the user has to go through the above steps after installing HAXM.
ka...@gmail.com <ka...@gmail.com> #51
SOLUTION A - HVF Solution: Running the emulator on Canary channel 26.1.x (API 25/26 recommended) with Hypervisor.Framework (thread #7)
I implemented this solution and it worked. I am using emulator now on macOS High Sierra.
A1 - If HAXM installed in Android Studio, uninstall it;
------ Go to SDK Manager > SDK Tools (or Appearance & Behaviour > System Settings > Android SDK)
------ Uncheck Intel x86 Emulator Accelerator (HAXM Installer) and Apply. This will uninstall HAXM.
A2 - You might need to first install HAXM in order to get HVF to work (thread #17).
------ Install standalone Intel HAXM as a regular .dmg install. Download from here:
*****
***** For any reason, you can uninstall standalone HAXM installation by;
*****---- sudo Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh
*****------- If above not work, try; sudo /System/Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh
A3 - Check whether your macOS supports Hypervisor.Framework or not: (thread #40)
------- $ sysctl kern.hv_support
------- kern.hv_support: 1 (if support =1, if not support = 0) (should support to implement HVF solution)
A4 - Find the file "advancedFeatures.ini". It may be placed in;
------- ~/.android/advancedFeatures.ini (thread #7) ( Users/<username>/.android/advancedFeatures.ini) or
------- /Users/<username>/Library/Android/sdk/emulator/lib/advancedFeatures.ini (thread #45) (I found mine here)
A5 - Open "advancedFeatures.ini" with an editor.
------ Find the line "HVF = off"
------ Change off to on; "HVF = on" (thread #7)
A6 - Restart Android Studio if it is open (Restart the computer if necessary). Create and RUN the emulator :) No more HAXM warnings :)
SOLUTION B - I didn't try this solution but several comments claim that it also worked. (thread #34,35,36,37) You can try this also, follow the instructions from here :
If this is not proper a comment in here, sorry. I just want to share summarized complete solution that worked for me and may help others facing the same problem to follow steps more easily. I hope it helps
de...@gmail.com <de...@gmail.com> #52
st...@gmail.com <st...@gmail.com> #53
Process: studio [794]
Path: /Volumes/VOLUME/Android Studio.app/Contents/MacOS/studio
Identifier: com.google.android.studio
Version: 4.1 (AI-201.8743.12.41.7042882)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: studio [794]
User ID: 501
Date/Time: 2021-02-19 15:27:39.749 +0100
OS Version: Mac OS X 10.10.5 (14F2511)
Report Version: 11
Anonymous UUID: AD634625-9D55-0777-AF08-959A64935DAA
Time Awake Since Boot: 2600 seconds
Crashed Thread: 0 AppKit Thread Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000303030353150
VM Regions Near 0x303030353150:
VM_ALLOCATE 00000007c0b77000-0000000800000000 [ 1.0G] ---/rwx SM=NUL
-->
MALLOC_TINY 00007fea5b400000-00007fea5b800000 [ 4096K] rw-/rwx SM=COW
Application Specific Information:
abort() called
Thread 0 Crashed:: AppKit Thread Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff854ef286 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff91d109a3 abort + 129
2 libjvm.dylib 0x000000010b2bfeb2 os::abort(bool) + 22
3 libjvm.dylib 0x000000010b3c95ff VMError::report_and_die() + 2151
4 libjvm.dylib 0x000000010b2c444a JVM_handle_bsd_signal + 523
5 libjvm.dylib 0x000000010b2c1dca signalHandler(int, __siginfo*, void*) + 45
6 libsystem_platform.dylib 0x00007fff8a327f1a _sigtramp + 26
7 libsystem_c.dylib 0x00007fff91cb3f72 strlen + 18
8 com.apple.CoreFoundation 0x00007fff8933484c __CFStringAppendFormatCore + 8524
9 com.apple.CoreFoundation 0x00007fff8942a3a0 _CFStringCreateWithFormatAndArgumentsAux2 + 256
10 com.apple.Foundation 0x00007fff90de14e1 -[NSPlaceholderString initWithFormat:locale:arguments:] + 153
11 com.apple.Foundation 0x00007fff90dfaec9 +[NSString stringWithFormat:] + 174
12 com.apple.java.JavaRuntimeSupport 0x00000001215170cc -[JRSInputMethodController currentInputMethodLocale] + 174
13 libawt_lwawt.dylib 0x0000000121577eda __Java_sun_lwawt_macosx_CInputMethod_getNativeLocale_block_invoke + 41
14 com.apple.Foundation 0x00007fff90e69da0 __NSThreadPerformPerform + 293
15 com.apple.CoreFoundation 0x00007fff89376821 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 com.apple.CoreFoundation 0x00007fff893689ad __CFRunLoopDoSources0 + 269
17 com.apple.CoreFoundation 0x00007fff89367fdf __CFRunLoopRun + 927
18 com.apple.CoreFoundation 0x00007fff893679f8 CFRunLoopRunSpecific + 296
19 com.apple.HIToolbox 0x00007fff87b3856f RunCurrentEventLoopInMode + 235
20 com.apple.HIToolbox 0x00007fff87b382ea ReceiveNextEventCommon + 431
21 com.apple.HIToolbox 0x00007fff87b3812b _BlockUntilNextEventMatchingListInModeWithFilter + 71
22 com.apple.AppKit 0x00007fff8c5fa8ab _DPSNextEvent + 978
23 com.apple.AppKit 0x00007fff8c5f9e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
24 libosxapp.dylib 0x00000001216481d5 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 121
25 com.apple.AppKit 0x00007fff8c5efaf3 -[NSApplication run] + 594
26 libosxapp.dylib 0x000000012164801a +[NSApplicationAWT runAWTLoopWithApp:] + 219
27 libawt_lwawt.dylib 0x000000012159e40b -[AWTStarter starter:] + 856
28 com.apple.Foundation 0x00007fff90e69da0 __NSThreadPerformPerform + 293
29 com.apple.CoreFoundation 0x00007fff89376821 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 com.apple.CoreFoundation 0x00007fff893689ad __CFRunLoopDoSources0 + 269
31 com.apple.CoreFoundation 0x00007fff89367fdf __CFRunLoopRun + 927
32 com.apple.CoreFoundation 0x00007fff893679f8 CFRunLoopRunSpecific + 296
33 com.google.android.studio 0x00000001082f7b77 main + 332
34 libdyld.dylib 0x00007fff8d2265c9 start + 1
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
sh...@gmail.com <sh...@gmail.com> #54
Basic setting I want ...
Description
The errors in the console are:
Emulator: Failed to open vm 7
Emulator: Failed to create HAX VM
Emulator: No accelerator found.
Emulator: failed to initialize HAX: Invalid argument
I'm assuming it's because Mac OS 10.13 isn't supported yet by Intel HAXM.