Error while debugging native and java-app on Android Studio - java

While developing an app for Android, I was able to debug native and managed code. But, once I disconnected the cable while in debug session and I close manually on the smartphone the app, it becomes undebugeable again:
java.lang.Throwable: LLDB server not found
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:137)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.newSessionStarter(ConnectLLDBTask.java:360)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.access$200(ConnectLLDBTask.java:91)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask$3.createDebugProcess(ConnectLLDBTask.java:598)
at com.jetbrains.cidr.execution.testing.CidrLauncher.startDebugProcess(CidrLauncher.java:29)
at com.jetbrains.cidr.execution.CidrCommandLineState.startDebugProcess(CidrCommandLineState.java:30)
at com.jetbrains.cidr.execution.CidrRunner$1.start(CidrRunner.java:63)
at com.intellij.xdebugger.impl.XDebuggerManagerImpl.startSession(XDebuggerManagerImpl.java:205)
at com.intellij.xdebugger.impl.XDebuggerManagerImpl.startSession(XDebuggerManagerImpl.java:166)
at com.jetbrains.cidr.execution.CidrRunner.startDebugSession(CidrRunner.java:56)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.launchCidrDebugger(ConnectLLDBTask.java:628)
at com.android.tools.ndk.run.lldb.ConnectLLDBTask.launchDebugger(ConnectLLDBTask.java:296)
at com.android.tools.idea.run.tasks.ConnectDebuggerTask.lambda$perform$0(ConnectDebuggerTask.java:90)
at com.intellij.util.ui.UIUtil$12.run(UIUtil.java:3098)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:755)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:704)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
the before stacktrace is from Android Studio after launching debug, it appears an ! at bottom right.
Then, the result in Debug window is:
Now Launching Native Debug Session
Error while starting native debug session: com.intellij.execution.ExecutionException: Index: 0, Size: 0
I am not able to debug now! That is happening to me and I am able to fix it by following these steps:
Close Android Studio.
Delete c:\Users\<USER>\{.android, .gradle, .AndroidStudio3.3}
Delete <ProjectFolder>\{.gradle, .idea}
Delete tmp files in AppData.
Open and re-debug app.
I found a faster way to temporally solve it by deleting two directories:
Close Android Studio
Delete c:\Users\<USER>\.lldb
Delete c:\Users\<USER>\.AndroidStudio3.4\system\tmp\*
Re-open Android Studio
Now you should be able to debug again

I was getting the same exception Error while starting native debug session: com.intellij.execution.ExecutionException
Then following helps me. Check if this can helps you...
Or open run configurations
Then check this...

What worked for me was uninstalling the apk and reinstalling it (using the debugger). Android Studio version 2021.1.1 for Ubuntu 18.04

Related

Offset Explorer 2 does not open on Mac Monterey (v12.4)

FYI: kafka noob here
I downloaded Offset Explorer 2 (Kafka Tool) on my Mac and when I open it, it shows up in my Activity Monitor for a few seconds and then closed. No UI appears and there is no error message displayed.
However, I was able to see the error log:
...
ERROR com.kafkatool.ui.MainApp - Error starting main application
java.lang.NullPointerException
at java.awt.Window.init(Window.java:497)
at java.awt.Window.<init>(Window.java:537)
at java.awt.Frame.<init>(Frame.java:420)
at java.awt.Frame.<init>(Frame.java:385)
at javax.swing.JFrame.<init>(JFrame.java:189)
at com.kafkatool.ui.MainFrame.<init>(MainFrame.java:97)
at com.kafkatool.ui.MainApp.<init>(MainApp.java:33)
at com.kafkatool.ui.MainApp.main(MainApp.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
at com.install4j.runtime.launcher.MacLauncher.main(MacLauncher.java:52)
What I have tried:
Uninstalling/Reinstalling
I tried installing via HomeBrew
I tried installing via downloading it form the official site
I tried uninstalling/reinstalling different version of Java (openJDK and the name-brand stuff)
rebooting
None of the above seems to have any affect. I still see the same error message in the log

android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false

I have upgrade the Android SDK project 30 to 31 and I also used permission in manifest: . which is required for targeting SDK 28 and above.
In Android 12 I am getting the frequently below crashes on 100% background application.
Also, below Android SDK version 30, its working absolutely fine.
Thanks in Advance !
Non-fatal Exception: java.lang.RuntimeException: Unable to create service com.UploadService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.UploadService
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4949)
at android.app.ActivityThread.access$1900(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2296)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
I have used work manager for startForegroundService in my code, how to use workmanager for startForeground to restrict this crash in Android12 and above
Thanks in advance

android.system.ErrnoException: read failed: EAGAIN in Android 5.0

When I tested my app on Android 8.0 it's work just fine, but when I test it on Android 5.0 it keeps crashing every time I launch a new activity or I click in items of navigation drawer, I get the exception below, can you please help me, I am not getting anything from crash log telling where my application is crashing
02-18 11:16:28.934 800-1189/? E/NativeCrashListener: Exception dealing with report
android.system.ErrnoException: read failed: EAGAIN (Try again)
at libcore.io.Posix.readBytes(Native Method)
at libcore.io.Posix.read(Posix.java:147)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
at android.system.Os.read(Os.java:364)
at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240)
at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
Problem solved by removing this code from xml:
android:shadowColor="#color/text_shadow_white"
android:shadowDx="-2"
android:shadowDy="-2"
android:shadowRadius="1"

Android Studio suddenly crashes at startup

I have not used Android Studio 2.3.2 for 3 or 4 days and suddenly I have got the error below when I try to launch it. Note that I installed separately Android Studio 3.0 Canary 1 one week ago but everything was ok and both versions worked without problems. I don't understand why I suddenly have a problem to launch Android Studio.
I use a MacBook.
Here is the error log given by Android Studio at launch:
Internal Error. Please report to https://code.google.com/p/android/issues
java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:203)
at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:47)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:358)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:248)
at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:43)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:536)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:119)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$8(ApplicationImpl.java:429)
at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:436)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:103)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:392)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:384)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:196)
... 16 more
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 2 path $
at com.google.gson.Gson.assertFullConsumption(Gson.java:837)
at com.google.gson.Gson.fromJson(Gson.java:827)
at com.android.sdklib.repository.targets.PlatformTarget.getLibsFromJson(PlatformTarget.java:179)
at com.android.sdklib.repository.targets.PlatformTarget.<init>(PlatformTarget.java:124)
at com.android.sdklib.repository.targets.AndroidTargetManager.getTargetMap(AndroidTargetManager.java:94)
at com.android.sdklib.repository.targets.AndroidTargetManager.getTargets(AndroidTargetManager.java:80)
at com.android.sdklib.repository.targets.AndroidTargetManager.getTargetFromHashString(AndroidTargetManager.java:154)
at org.jetbrains.android.sdk.AndroidSdkData.findTargetByHashString(AndroidSdkData.java:216)
at org.jetbrains.android.sdk.AndroidSdkAdditionalData.getBuildTarget(AndroidSdkAdditionalData.java:126)
at org.jetbrains.android.sdk.AndroidPlatform.parse(AndroidPlatform.java:90)
at org.jetbrains.android.sdk.AndroidSdkAdditionalData.getAndroidPlatform(AndroidSdkAdditionalData.java:137)
at org.jetbrains.android.sdk.AndroidPlatform.getInstance(AndroidPlatform.java:68)
at com.android.tools.idea.startup.GradleSpecificInitializer.checkAndSetSources(GradleSpecificInitializer.java:459)
at com.android.tools.idea.startup.GradleSpecificInitializer.checkAndSetAndroidSdkSources(GradleSpecificInitializer.java:449)
at com.android.tools.idea.startup.GradleSpecificInitializer.run(GradleSpecificInitializer.java:121)
at com.android.tools.idea.AndroidInitialConfigurator.activateAndroidStudioInitializerExtensions(AndroidInitialConfigurator.java:198)
at com.android.tools.idea.AndroidInitialConfigurator.<init>(AndroidInitialConfigurator.java:65)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:495)
... 28 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 2 path $
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1574)
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1423)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:546)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:429)
at com.google.gson.Gson.assertFullConsumption(Gson.java:833)
... 54 more
Thanks for your help !
Fixed the problem.
What I have done:
close Android Studio
go to /users/your_name/library/preferences
rename the folder 'AndroidStudio2.3' to 'AndroidStudio2.3XXX' (or whatever :))
restart Android Studio
As my Android SDK was in located in an unusual folder, Android Studio asked me if I want to tell where is my SDK (choosing this option did not solve the problem) or install it at the default Android Studio location ; I chose this last option and it solved the issue !
There was a similar issue posted on Androids open source bug tracker: https://code.google.com/p/android/issues/detail?id=74458
The solution was to restart your computer. Try this and see if it works.
I had that crash too. I guess it was due to the upload of the last project. so to prevent that upload I moved it from the androidstudioprojects folder which is where all the projects are stored,and it solved the problem-the studio initialized well. but after that I brought the project back to that folder and opened it from the studio,and it was crashed again. since I have another newer version of android studio, I used it to open that project. after it finished the whole process (indexing,building etc) I closed that project and tried again to open from the first version of the studio and it succeeded.
I guess last time I worked with that project I closed it not well (through task manager) and it affected something.

Error Running 'react-native run-android' on ubuntu 14

I have been trying to setup run my first react native project and have followed the steps provided here. But i keep getting this error when i run
$ react-native run-android
what i get is this
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Unzipping /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip to /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
I have searched and all i have seen so far are genymotion user solutions.
Any idea on how to fix this?
Oh, i found the error, the zip file in
/home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip
was corrupt that's y it could not be unzipped by the java.
So I have to go into the folder and delete the zip file mannualy and then run
react-native run-android
again. Hope that helps someone else. This is usually due to internet connection issues.
Set your ANDROID_HOME environment variables. Check your adb devices first. If your device is available. See the cyprusglobe suggestion.
Run:
- chmod 755 android/gradlew
- react-native run-android

Categories

Resources