MIUI 11/12 Theme Switch Results in LifeCycleException, ClassCastException - android-studio

Since MIUI 11/12 Use Its Own Custom Implementation of Dark Mode, using below code results in ClassCastException
and Activity Life Cycle Exception, as DefaultNightMode and LocalNightMode is always Unspecified i.e. -100 instead of 0 or 1.
If anyone has built a workaround for Xiaomi Devices specially for MIUI 11/12. Please Help Me Out On this.
Code Used:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
this.recreate();
Error Caused:
2020-10-25 07:04:43.626 9167-9167/com.xxxx.xxxxxx E/ActivityInjector: get life cycle exception
java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction

I solved it myself. After fiddling around with it for a week, I did it..
Here is how:
-- Instead of setting android:forceDarkAllowed="false" for each and every Activity.
-- Just goto values.xml and place this in your AppTheme
<item name="android:forceDarkAllowed">false</item>
It will ask you to create a valuesv29.xml. Create it, and remove the forceDarkAllowed="false" from all activities.
Welcome. :)

Also in jetpack compose just add the line to the theme.xml
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
With this target api worked fine for me

Related

Tokenization is skipped for long lines for performance reasons. The length of a long line can be configured via `editor.maxTokenizationLineLength`

I'm at a loss here. I have a Node.js server built for my project and out of nowhere, I started getting this error when I try to run the server in VSCode:
Tokenization is skipped for long lines for performance reasons. The length of a long line can be configured via editor.maxTokenizationLineLength.
I had edited some of my functions in my controller before this started. I discarded all changes but the error still persists. I don't understand what has changed for this to happen. Any advice would be greatly appreciated.
My code is here if you want to take a look
https://github.com/Kevinclane/timeclock
I fixed this problem by increasing Max Tokenization Length in VSCode :
Go to File--> Preferences--> Setting
Search for Max Tokenization Length
Change the default value to 2000000
I hope this will help
Apparently, just toggling the options for breakpoints on caught and uncaught exceptions causes it to fail... Doesn't make sense, but it works now.
This is not actually an error as such. If you assign really long length string to a variable, you might see this:
However, you will be still able to use that variable.

Syntax highlighting gone in Android Studio 3.3.1

Recently, syntax highlighting stopped working for me in Android Studio.
And I believe it's related to my project and not Android Studio itself.
From my understanding, the below error message gets thrown when I open certain files and the syntax highlighting isn't executed. If I edit the file by removing a line of code or so, however, syntax highlighting will show up again.
Going through and searching for the stacktrace doesn't give me any real indicator on what might be wrong, so here I am. Do you know what might be wrong?
I've tried clearing caches, reinstalling and playing with different settings in Android Studio without any effect, which leads me to believe that this is related to the project directly. Moreover, if I create a new project, syntax highlighting works as normal.
What I see...
Full stacktrace...
org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassMemberMatchingError$NoMatch: Couldn't match ClsMethodImpl:hashCode MemberIndex(index=10) (with 0 parameters)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder.assertMatches(LazyLightClassDataHolder.kt:145)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder.access$assertMatches(LazyLightClassDataHolder.kt:32)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder$LazyLightClassData$getOwnMethods$$inlined$map$lambda$1.invoke(LazyLightClassDataHolder.kt:138)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder$LazyLightClassData$getOwnMethods$$inlined$map$lambda$1.invoke(LazyLightClassDataHolder.kt:100)
at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.getClsDelegate(KtLightMemberImpl.kt)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl$_modifierList$2.invoke(KtLightMemberImpl.kt:47)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl$_modifierList$2.invoke(KtLightMemberImpl.kt:35)
at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.get_modifierList(KtLightMemberImpl.kt)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.getModifierList(KtLightMemberImpl.kt:52)
at org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl.getModifierList(KtLightMethodImpl.kt:127)
at com.intellij.codeInsight.AnnotationUtil.isAnnotated(AnnotationUtil.java:244)
at com.intellij.codeInsight.AnnotationUtil.lambda$isAnnotated$4(AnnotationUtil.java:234)
at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
at com.intellij.codeInsight.AnnotationUtil.isAnnotated(AnnotationUtil.java:234)
at com.intellij.codeInsight.MetaAnnotationUtil.isMetaAnnotated(MetaAnnotationUtil.java:154)
at com.intellij.execution.junit.JUnitUtil.lambda$isJUnit5TestClass$1(JUnitUtil.java:280)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:140)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:87)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:139)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:126)
at com.intellij.execution.junit.JUnitUtil.isJUnit5TestClass(JUnitUtil.java:276)
at com.intellij.execution.junit.JUnit5Framework.isTestClass(JUnit5Framework.java:52)
at com.intellij.testIntegration.JavaTestFramework.isTestClass(JavaTestFramework.java:64)
at com.intellij.codeInsight.TestFrameworks.computeFramework(TestFrameworks.java:92)
at com.intellij.codeInsight.TestFrameworks.lambda$detectFramework$0(TestFrameworks.java:63)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:140)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:87)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:139)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:126)
at com.intellij.codeInsight.TestFrameworks.detectFramework(TestFrameworks.java:62)
at org.jetbrains.kotlin.idea.core.platform.impl.JvmIdePlatformKindTooling.getTestIcon(JvmIdePlatformKindTooling.kt:60)
at org.jetbrains.kotlin.idea.highlighter.KotlinTestRunLineMarkerContributor.getInfo(KotlinTestRunLineMarkerContributor.kt:66)
at com.intellij.execution.lineMarker.RunLineMarkerProvider.getLineMarkerInfo(RunLineMarkerProvider.java:46)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:174)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:96)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:80)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:91)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:423)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1164)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:416)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:415)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:391)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Naturally when posting about an issue, the solution reveals itself shortly thereafter.
I have equals & hashcode overridden in one class (Entity) and both methods are marked as final. The issue comes up whenever a data-class extends Entity, Im guessing because its trying to create its own equals & hashcode methods, but cant.
Hope this helps anyone else out there! I think the behavior is correct (a data class has a very specific equals/hashcode) so I dont consider this a bug in the Kotlin plugin, but a better error message would be preferrable in the future.

JGoogleAnalyticsTracker initialization failure in UML Designer plugin

I am getting a repeated error while using OBEO UML-Designer plugin version 6.0.0.2 for Eclipse Mars. There is a setting in Eclipse Preferences under Windows-Preferences-Sirius-UML Designer Usage - the check box that indicates whether collection of data is allowed or disallowed, in my case the box is unchecked, so it should not attempt to collect the data. However, it appears trying to collect the data and fails for some reason as indicated below:
!ENTRY org.eclipse.ui.workbench 4 2 2016-11-22 15:39:08.529
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.NoClassDefFoundError: com.dmurph.tracking.JGoogleAnalyticsTracker (initialization failure)
at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:87)
at org.obeonetwork.dsl.uml2.usage.analytics.SiriusEditorsListener.(SiriusEditorsListener.java:67)
at org.obeonetwork.dsl.uml2.usage.analytics.UsageStartup$1.windowActivated(UsageStartup.java:65)
Multiple occurences of the same error are logged by Eclipse. Can someone help to resolve the issues, please?
your help is greatly appreciated!
thanks,
victor
I add a new issue in the UML Designer tracker, I will try to fix it for the next 7.2.0 version: https://github.com/ObeoNetwork/UML-Designer/issues/902
You should know that even if you have an error we do not track anything when you unchecked the preference.
Thanks for your feedback!

WinRT - Windows Store - WinRT Originate Error - How do decipher such an error?

I'm working on a Windows Store app and I'm getting a WinRT error that doesn't really give me any information so I would like to know how to understand these sorts of errors.
Basically I get the error on the following line which is called inside OnPointerPressed:
m_gestureRecognizer->ProcessDownEvent(args->GetCurrentPoint(nullptr));
The error is:
First-chance exception at 0x76F54B32 (KernelBase.dll) in DXAML2.exe: 0x40080201: WinRT originate error (parameters: 0x80070057, 0x00000044, 0x03CEE72C).
This error didn't used to appear, the only thing I've changed is that this line is now wrapped in an if clause which tests if the current pointer's PointerId is the same as one I've stored just using == such as:
if(args->GetCurrentPoint(nullptr)->PointerId == m_UIPointerID)
I have no idea why this has started happening.
So my question is in two parts:
More generally, how do I understand what an error such as the above means?
And does anyone know this error has suddenly started happening now that I check the pointerId?
Thanks for your time.
P.S. I guess another thing that has changed is that there will already be 2 pointers on the screen (the one that gets pushed into this GestureRecognizer) as well as another one, hence the PointerId check.
"How to Decipher such an error"...
For any WinRT originate error, you can take the third address in the parameters list (in your example, 0x03CEE72C), and find a description of your error in the memory window.
While debugging, break when your error is thrown and open the memory window via Debug -> Windows -> Memory -> Memory 1
Copy and paste the address to get your "easy-to-find" error message.
As Raman said - it's good to look up the hex values shown. The first one is the memory location which won't tell you much without the symbols/source, which in this case is reported directly by Windows. Perhaps the public symbols can shed some more light on where the error came from, but the error code lookups are more helpful.
If you Bing for 0x80070057 you will find an MSDN article on Common HRESULT Values which lists
E_INVALIDARG : One or more arguments are not valid : 0x80070057
It doesn't give you all the details of course, so you're off to theorize. Perhaps you can only call args->GetCurrentPoint(nullptr) once and you should store/reuse the value? Maybe gesture recognizer is not configured correctly? Maybe the app window is not visible at the time the exception is thrown or the thread is wrong. Maybe some expected calls to gesture recognizer were missed due to filtering those out with these "if" statements.

Issue with basic AS3 workers classes

I have followed Lee Brimelow's tutorials (part 1, part 2), but somehow my project doesn't work as expected.
Currently, publishing "src/Secondary.as" to "www/assets/swf/secondary.swf" works properly, however when trying to run "src/Main.as", an error shows up:
Exception fault: TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Main/init()[/Volumes/DOCUMENTS/Tests/AS3/test-workers/src/Main.as:52]
at Main()[/Volumes/DOCUMENTS/Tests/AS3/test-workers/src/Main.as:32]
If anybody has time, you can look at my code on Github and maybe see where I screwed up? Thanks a bunch!
As your error message says: the problem raised in Line 52 in your Main.init()method. What you try to do there is to create a new instance of SecondarySWF. I would say that your embedment of Secondary class into SecondarySWF doesn't work properly, so it is not available in your init-method. You should set a breakpoint at the first line of your init-method and when the debugger reaches this point check what's in SecondarySWF. I expect that there's nothing in that variable, so what your new SecondarySWF() then means actually is new null().
Because you embed your secondary.swf with a MIME-type specified the Flex compiler ignores it because it is unable to detect the actual type of data in the loaded file. I found this post on Adobe's cookbook page that explains what you have to do in addition to adding the file using [Embed]. Hope this will fit your needs.

Resources