Flutter - how to debug the native android code - android

I have been trying to debug the native android code that is invoked through platform channel in flutter and the debugging is only in the flutter side. The execution doesn't hit the breakpoint in the native android. The application is working as expected but the debugging doesn't. I am using Android studio. Can some one please tell me how to debug the native android code ?

Breakpoints are working fine for me when using Android Studio at project/android/, on both emulator and physical device. And remember to Debug instead of Run (^D instead of ^R). Note, it did not work when opening the project from project/.
I don't think making a new android project to write the Native code for a flutter app is a good option (vivek's suggestion). There are many Flutter specific considerations you need to make on the native side, it is not just an Android app.

If you navigate to MainActivity.kt or MainActivity.java in the android studio then you can see "Open for Editing in Android Studio" on the top right.
click on that and it will open you a new window where you can easily write native code.
Well, better if you can write whole code in a new android project and test there then use that code to make flutter plugin. I think this will be faster than to edit in flutter project.
let me know what others think.

The answer given by #Marcos Boaventura to follow this blog helped fix the issue. https://medium.com/flutterpub/flutter-app-couldnt-find-libflutter-so-c95ad81cbccd
After fixing the gradle the debug is successful. Thank you #Marcos Boaventura

I had a similar problem. Debugging native code on an emulator worked, while debugging on a physical device (Zebra TC25, Android 7.1) crashed with a Fatal signal 11 (SIGSEGV). Switching from the Flutter beta channel to the Flutter stable channel fixed it for me.

Related

Flutter demo app doesn't work, detects problems

I have a problem with demo app in flutter. I don't know why but Visual Studio Code keeps detecting problems right after I create the project. I can't start the app.
I tried reinstalling VSC, Android Studio and all the extensions. Nothing works. Everything worked fine before I upgraded my RAM. Could that be the issue somehow?
problems that it detects
Open your terminal and run flutter pub get.
Also you can open pubspec.yaml and click

Android Studio Flutter Manifest Multiple Errors

I am an intermediate Android Apps developer who uses java. Recently I tried to switch to Flutter and default app works fine debug on my cell phone through cable.
I just happened to look at Android Manifest and there are multiple error showing:
But to my surprise it shows no error on device.
I have set Flutter, dart and git path already. It would be nice if someone can help with theses errors.
This is normal since you are operating on a Flutter project, and not an Android one.
Try to Open the project from your-app-folder/android.

React native app cannot run after upgrade

Hi guys been trying to run my react native project but have failed. Initially, i could deploy it very well on my device while using linux, but when i ran it on windows now it throws an. Can any one help me out, here is the screen shot on my nodejs console.
You see the list of actions to take to fix the issue? I would do each of them.

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.

Problems running app on actual device

OK, please take it easy on me, I am new to the whole Xamarin community. I have built a simple calculator app using MVVMCross. When I run the app in an emulator everything works great. It still needs some UI attention, but functionally it all works. When I go to archive it and make an install on my phone, it installs just fine. The issue is when I go to run it. As soon as it opens I get an error message. "Calculator.UI.Droid has stopped" Open app again. I have gone through everything I can find online to do this and nothing is working.
Here is my setup:
Visual Studio 2017 Community with latest updates
Windows 10 with latest updates
Latest Java SDK
Project Properties:
Compile using Android Version 7.1 (Nougat)
Minimum Android Version 5.0
Target Android Version 7.1
Use Fast Deployment - false
Generate one package (.apk) per selected ABI - unchecked
Enable ProGuard - checked
Linking - SDK and User Assemblies
Android Phone:
Google Pixel 2 with latest updates.
Any help would be appreciative. Just let me know if you need more information. Thanks in advance
I myself are also using Xamarin, and quite often I get this problem, most times it is related to the code, so please make sure that's the case.
comment out your calculator stuff, and try running the basic app on your physical device. if that works try to find the problem, idk if you can use breakpoints because your problems happens on boot.

Categories

Resources