Android Studio can't debug if I use C code - android

Android Studio can't start the debugger if I use C code though JNI.
Running it normally works well, but the debugger doesn't even start, regardless if I'm debugging Kotlin or C code.
It throws a message Debugger process finished with exit code 127. Rerun 'app'
And the only detail it gave me is com.intellij.execution.ExecutionFinishedException: Execution finished.
Here I set up a simple github repository to replicate the error: https://github.com/perojas3/Android-JNI-debug-bug-example. It simply calls C code to get a string and then displays it in a toast.
And here I set up an small youtube video displaying the bug the way it is happening: https://youtu.be/8jIL5yqP7m8
I'm using Manjaro Linux right now.

I had the same issue and installing libncurses5 package solved it.
If using Ubuntu: sudo apt install libncurses5 and launch the debugger again (no android studio restart required).

I also had this issue.
I was able to run and debug my code normally, but for some reason I started to get this crash while running on debugging mode:
Debugger process finished with exit code 127
After playing a lot with Android Studio's settings and Edit Configurations, clearing caches, restarting both Android Studio and the computer and many other things, nothing was helpful.
I struggled with it a lot and the fact that there're no discussions anywhere about it annoyed me a lot, so having no information online together with the previous feeling about it happening after upgrading to Android Studio 4.2, made me think maybe it's a new issue raised in Android Studio's new 4.2 version.
So, I decided to download Android Studio 4.1.3 and give it a try. It worked like a magic and I can finally debug my code :)

Related

Xamarin no longer debugging my app

I've been working on a Xamarin project for a few days and have been testing it fine, but today it has suddenly stopped allowing me to debug the app, either via Live Player, or by connecting my smart phone via USB.
The only error I am getting, as far as I can see, is
Failed to debug your app
I've not got a way of testing it on iOS devices, but the built-in Windows Phone emulator runs the app fine, albeit with an error in my code popping up now and then.
What could be causing the Android version to stop debugging, or how do I at least fix it?
There are a couple of steps that can help with that issue:
Clean the solution and exit visual studio
manually delete the .vs folder in your solution directory
Delete the /obj and /bin folders in your shared code, and in each project for the platforms you are using
if you are developing for iOS, sometimes it helps to restart your mac
Start Visual Studio
Rebuild your shared code project
Rebuild every native project
Beyond that also make sure that you are using the latest versions of Visual Studio, Xamarin and Xamarin.Forms on all your computers, and that the nuGet Packages your project is using are at the very same version each in shared and native code
Also check, if your app isn't throwing an unexpected exception during its initialization. Especially if not caught, it can happen that your app crashes before your code gets executed at all.
In addition you may find further information about what is going on at Help -> Xamarin -> Open logs or in the device management in XCode (iOS only)
Try this :
Close visual studio if open.
Open App Data and then go to
(a) Local\Xamarin
(B) Local\Xamarin\Xamarin.Android
Empty these folders.
Open your project and then try to build your application.
Not a proper solution, but I uninstalled and reinstalled Visual Studio. This seems to have fixed the problem, but I've still no idea why it stopped working in the first place.

Android, Xamarin: Unable to start program "The system cannot find the file specified"

this is so annoying.
Yesterday, everything worked fine. I commited my work on my app and went to bed.
Today- nothing works.
I try to debug my program, the app installs on my phone and works but the debugging stops only with: Unable to start program "The system cannot find the file specified".
No matter how ofter I rebuild, set my project as start project, change the target api, or what not. I even updated everything on my computer but it is hopeless.
Please, help me :(
This looks like a promising solution for this issue but somehow it didnt work for me, so I tried to repair my Visual Studio 17 and it worked.
For repairing visual studio you have to download visual studio installer from official microsoft website
If VS is already installed in your machine you'll get a screen with options :- Update, Launch and more.
select more and click repair.
You have to wait until VS finishes repairing. Hope you'll get rid of this annoying issue.
I had a similar issue, and solved it like this:
As Luminous_Dev figured out here:
forums.xamarin.com/discussion/123640/xamlctask-error-on-new-cross-plat-solution
make sure Mono Debugging for Visual Studio is enabled.
Tools > Extensions and Updates> Mono Debugging for Visual Studio
Source: https://forums.xamarin.com/discussion/123611/unable-to-start-debugging-the-system-cannot-find-the-file-specified
make sure Mono Debugging for Visual Studio is enabled.
Tools > Extensions and Updates> Mono Debugging for Visual Studio

Android Studio gradle build stuck at app:processDebugResources

I'm on Windows. I created a new project on Android Studio for Marshmallow at least.
The only thing I've done so far is generating the main activity which is a tabbed activity with view pager. Also, you should know that this project is a private git repo that I cloned.
I'm working on this project with another developer and the project is perfectly working on his side.
The problem is:
When I try to launch the app (wether it is a virtual device or my real phone), the gradle build gets stuck at the app:processDebugResources step. I waited more than an hour and nothing happened. Moreover, when I want to cancel the gradle build, it doesn't respond and I have to kill Android Studio process. Then I restart Android Studio and I have to kill a gradle process that prevents the initial gradle build (at Android Studio startup) from working.
The crazy thing is that I was able to launch the app before. I even installed it on my phone!
What I've tried so far:
Do what stackoverflow was giving as solutions like tick the offline mode in the settings
Create a new project --> It doesn't change anything
Reinstall Android Studio --> It doesn't change anything
Deactivating Avast antivirus
Invalidate cache/restart + Clean + rebuild (the rebuild gets stuck like when I try to launch the app)
And maybe other solutions that I forgot...
It's getting very annoying as it's making me lose days of development.
If you have any more solutions, or if you think I should try again some of the previous solutions, help would be greatly appreciated !
I know this is an old post, but I faced the same problem during the last few days and since i got crazy I hope I can help someone else out there.
After many hours of troubleshooting I found that the Java Platform SE binary executable goes in "suspended mode" in Windows 10, preventing Android Studio from compiling (it hangs at app:processDebugResources).
Example Screenshot
Killing the suspended process and recompiling the project works just fine... until Java gets suspended again.
Maybe your gradle version is not compatible with it. Try again with latest version of gradle in your project.
I did several things:
Install NDK
Change JDK from embedded one to Jdk 8
Redownload SDK i was using (6,7,8)
And now the problem is solved ! I have no idea which of these things made the tricks but I'm happy ! It may be useful to someone else one day.

Android emulators don't start

Since yesterday, my android studio emulators don't start. It was just after i updated Android Studio Library, i don't know if it is just a coïncidence.
What happens when i press start is:
The emulator command is executed
I see emulator.exe process in windows task manager, but no window is opened
Before that, the emulators started just fine, i had no problems, so it shouldn't be hardware issues.
I tried to launch it from the command line, to see if there were errors, but there's nothing. I also checked android studio's logs but still nothing... I also reinstalled completely android studio with no effects. I also tried to let it run for awhile but nothing appears.
Does anyone have a clue about what could cause this ?
EDIT :
It was a known issue (GPU related) of the SDK Tools 25.1.1 , it has been updated about 5 days later and now it works perfectly.
I had exactly the same issue.
Removing C:Windows\System32\Wbem from system PATH variable helps me:
https://stackoverflow.com/a/36650430/1901621

Android Studio stuck while building application

I recently switched from Eclipse to Android Studio because I read that it is now the official IDE for Android application development. I downloaded and installed the latest version (1.0.2) for Windows. When using the program for the first time, I decided to create a test application to see if the program was working correctly. Unfortunately, it was not. Once I clicked the finish button to complete the New Project Wizard, A loading bar showed up that said Gradle: Build. This is where the program gets stuck. There is no error message and it appears that the program is running fine, however the build never actually completes. I am never given my MainActivity.Java class, or my activitymain.xml document. If I click the cancel button, the program freezes and I have to use the TaskManager to kill the program. If I re-enter the program and choose to open an existing project, my project will be there. However, upon trying to open the project, I am greeted with the same Gradle: Build loading bar.. I have been searching for an answer for the last 3 days and nothing has worked. Any help is greatly appreciated!
Things I have tried:
Simply letting the program sit for a while to see if it was actually downloading something and was just really slow. I let it sit for 45+ minutes before killing the program.
Uninstalling and re-installing Android Studio
Restarting my computer
Turning off my firewall (Kaspersky)
Running the program as an administrator
Connecting to a different network
Disconnecting my computer from any networks (to force the program to build in offline mode)
Manually downloading Gradle from the link that Android Studio attempts to use when it gets stuck and telling the program to use that file instead of downloading another one.
(I went to this link https://services.gradle.org/distributions/gradle-2.2.1-all.zip, downloaded the file, unzipped it, went to Gradle settings in Android Studio, checked the Offline work checkbox, and finally set the service directory path to my unzipped Gradle folder.)
Hopefully I have given enough information and made it clear what my problem is. If not please tell me what else I need to explain so I can get this issue resolved. Thanks!
Please note I am working on a 64 bit machine running Windows 8. Also, I use studio64.exe
to run the program.
From the discussion we had in the comments, it does not look like you have your gradle on your windows path.
Please change the below to point to your gradle install:
set GRADLE_HOME=C:\<installation location>\gradle-1.11
set PATH=%PATH%;%GRADLE_HOME%\bin
After this, verify that in the terminal running the following works:
gradle tasks
once you get this working, you will want to run the following in your project:
gradle wrapper
This will produce a .bat file which you can then use to run gradle through the wrapper, letting you support multiple native gradle installations.

Categories

Resources