There's an option in the Android project settings in the Android Options section on the Packaging tab that lets you choose between the Xamarin debugger or the Microsoft debugger. The Xamarin debugger works, but not as good as the Microsoft one might. Unfortunately I get an error message when trying to use the Microsoft debugger and deploy on one of the Visual Studio Android Emulators.
Unable to start debugging. Non-debuggable application installed on the target device. Required file '/data/data/My.Application/lib/gdbserver' could not be found on the device. Please install a debuggable version.
Is there any way to get the Microsoft debugger to work?
The Xamarin debugger can only debug managed (i.e. C#) code. Breakpoints only work with the Xamarin debugger if the project being debugged is a managed project. They don't work if the project is a native app or native library.
The Microsoft debugger can only debug native (i.e. C/C++) code. Breakpoints only work with the Microsoft debugger if the project being debugged is a native app or native library, or if it is attached to an already-running Android process.
To get gdbserver into the app package, you either have to reference a native code library from your managed app, or include it (with build action set to AndroidNativeLibrary). I found you can also add a link to gdbserver (again, with build action set to AndroidNativeLibrary) from a project and make use of path sniffing to select the gdbserver from the matching ABI. Snippet of project file:
<ItemGroup>
<AndroidNativeLibrary Include="$(ANDROID_NDK_ROOT)\prebuilt\android-arm\gdbserver\gdbserver">
<Link>lib\armeabi-v7a\gdbserver</Link>
</AndroidNativeLibrary>
</ItemGroup>
Also please see my answer to a similar question.
Related
I'm quite new to NativeScript. Currently, one of my projects is using NativeScript to develop cross-platform app. It has a 3rd-party lib which is written in java. But the result is not as good as I expected. I was struggling to find the problem since the console didn't log valuable info regarding to native code.
Instead, I import the project to Android Studio which is under the folder of platform/android. But it logs error when I hit the "run" button.
I want to know:
Is it possible to debug native code directly with VS Code. At least print out java native error or cat log.
How can I debug native code in Android Studio? How to solve the problem I ran into?
I'd be very appreciated, if anyone can answer my questions. Thanks!
Let me start off by saying there's no official integration with Android Studio. All I can provide is a workaround that will make it possible.
Note: The steps provided below are tested with NativeScript CLI 3.1.1 and will probably work also with 3.2.0.
The first problem is you don't have "node" set in your global path so first of all, you need to add it to PATH. Node required for NativeScript to run. You can look at how to set it up here
If you want to be able to run the project with Android Studio you can follow these steps:
After you've done that you need to change the <app_name>/platforms/android/build.gradle file as described here
The above change will enable you to open <app_name>/platforms/android in Android Studio
Run <app_name>:clean task from gradle
Run the task default for Android Studio, that will prompt you for emulator or device on which to run:
Is there a way to debug native java code for Android app built using react-native. Specifically, I want to debug a third party Android package that I am using in my react-native app. There are may blog posts and stackoverflow questions on how to debug the js code but I didn't find any post describing how to debug native java code. I tried to just import the third party Android package into Android Studio and tried to run it in debugger but nothing really happened which I kind of expected.
Please let me know if and how it can be achieved. Thanks!
You can open the project in Android Studio and debug any native code there (add breakpoints, debug step by step, etc).
Be sure to launch the React Native packager beforehand. And then launch your app from Android Studio in debug mode.
More info: https://developer.android.com/studio/debug/index.html
Launch the React Native packager by running 'react-native start' in the root directory of your React Native Project.
Open the "android" directory of your React Native project in Android Studio.
Then you will be able run and debug your React Native application from Android Studio.
The way I could debug java code is the following:
shell: npm run android
Android Studio: "Attach debugger to Android Process" ->
Voila!
I use Android Studio 1.5.1 and Windows 7. I installed LLDB, but when I put a breakpoint in my native code, nothing happens. It may be necessary to set some settings in native debugger to make it work?
I can't believe I can't don't allow to debug my native code in such a powerful tool like Android Studio.
About same question has been asked at the end of the link, you can check the answer.
How to get NDK debugging to work in Android Studio?
I built Qt5 for Android with the step by step tutorial from this link:
Building Qt 5 for Android.
Now, i'm able to build and deploy QWidget Applications to my nexus 7. But if i try to build a QtQuick Application with the given template of QtCreator 2.7.1, i get the following error:
Project ERROR: Unknown module(s) in QT: quick qml
I did every build step exactly as described in the tutorial. Has anybody else faced this error?
QtQuick works perfectly well with Qt5.2. My suggestion is that you built Qt5.2 from source, instead of simply installing it, i.e. you clone it from Gitorious. After you check all the details, once you put it to build, go for a coffee as it will take a while to finish it.
Also, have you installed the Android SDK and NDK? If not, my suggestion is that you install the Studio Android.
You will also have to be very careful in making all the environment setups for your cross-compiling tool-chain otherwise it will not work. Check in the sequence what I have for my development settings.
Ant is also part of the installation, as you probably won't wish to miss that.
In the end if you have done all the settings accordingly, without forgetting anything, then you just need to select Qt Quick Application.
And it will work, as qt quick is officially supported on Android Qt5.2.
Is it possible to debug a native Android application with eclipse and the Android SDK. I have downloaded the sources. Would I have to build the app and then deploy it onto the device to debug it (like any other debugging process)? If so, how would I go about doing that (can use messenger/call app if needed).
You can debug native android applications using eclipse and ndk-gdb. The detailed information you can find here