Way to debug mixed JNI code? - c++

I've been looking around to find an easy way to debug my JNI code, you know, to be able to freely jump into native code and back into java code.
The solutions which I found were sort of out of date or got some restrictions. Some required specific ndk version, some required specific Eclipse version. Here my target is Android 1.6 & 2.2, I'm using Eclipse 3.6 Helios, and NDK r5b. Is there a general solution for this mixed debugging? Thx.

Citate from $NDK/docs/NDK-GDB.html:
IMPORTANT: Native debugging can only work if all these conditions are met:
1. Your application is built with the 'ndk-build' script:
Building with the legacy "make APP=<name>" method is not
supported by ndk-gdb.
2. Your application is debuggable:
In other words, your AndroidManifest.xml has an <application>
element that sets the android:debuggable attribute to "true"
3. You are running your application on Android 2.2 (or higher):
ndk-gdb will not work if you try to run your application on
previous versions of the system. That does not mean that your
application should target the Android 2.2. API level, just
that the debugging session should happen on a 2.2+ device or
emulator system image.
so, you can't use device with 1.6.
How to setup environment to debug jni code: i used this recipe, it works for me.

Related

Getting Error When Switching to Platforms Other Than "Windows, Mac, Linux"

I'm using unity-sdk version 6.0.0 in Unity 2021.3.9f1. When I switch to any Platform other than "Windows, Mac, Linux" I get the following error in the console:
Assets\IBMSdkCore\Connection\RESTConnector.cs(668,24): error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
Switching back to "Windows, Mac, Linux" clears the error. I have ensured that when viewing Assets/Watson/WatsonUnitySDK in the inspector that under Platforms only "Any Platform" is checked and that nothing is checked under "Exclude Platforms".
Any assistance would be greatly appreciated, thanks in advance.
The answer is in the "Configuring Unity" section of the unity-sdk GitHub repository:
"If using Unity 2018.2 or later you'll need to set Scripting Runtime Version and Api Compatibility Level in Build Settings to .NET 4.x equivalent. We need to access security options to enable TLS 1.2."
The setting is now labeled ".NET Framework", but switching to it from ".NET Standard 2.1" resolved the error.
I'm almost certain I remember setting the .NET version per the instructions when I originally set up the project, but I may be mistaken. Anyway it's fixed now.
EDIT: I had set the compatibility to .NET Framework. I just discovered that every time you change the build platform Unity reverts to 2.1 and you have to manually go switch to .NET Framework again.

The specified Microsoft.NETCore.App', version '2.0.7' was not found

cannot start .NET Core app because of this error:
"It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.7' was not found.
- Check application dependencies and target a framework version installed at:
\
- Alternatively, install the framework version '2.0.7'.
The program '[1560] dotnet.exe' has exited with code -2147450749 (0x80008083)."
Editing .csproj didn't help. It looks like this:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.7</RuntimeFrameworkVersion>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
You don't have the right .NET Core runtime installed. It's not good enough that's a .NET Core 2 runtime; it needs to be a minor version that is equal to or encompasses the version you're trying to target. You can see all the available runtimes here: https://www.microsoft.com/net/download/all. Specifically, you need 2.0 Runtime (v2.0.7) or higher. You can just choose 2.1, though. 2.0.7 will be rolled in and then, if you do end up upgrading your project later, you won't run into this issue again.
After playing around for a (longer) while, eventually it turned out that the solution is to comment out RuntimeFrameworkVersion in .csproj:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<!--<RuntimeFrameworkVersion>2.0.7</RuntimeFrameworkVersion>-->
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
It is worth mentioning that the problem occured after my collegues upgraded a .NET Core to higher version and I did 'Get latest version'.

Air Native Extensions: Released Air App w/Windows Native Extension works fine on develpment PC but not on other computers

I'm working on an AIR app that uses a Native Extension for windows that I developed for the same project. The app calls an ANE method called pingFunction and passes it a String containing the IP address where the pingFunction will perform, believe it or not, a ping test.
The application and it's ANE work great on Flash Builder and even after making it a release, they keep working like a charm on the development PC. The problem is that I've tried on two other computers and the application is throwing the following error:
ArgumentError: Error #3500: The extension context does not have a method with the name pingFunction.
at flash.external::ExtensionContext/_call()
at flash.external::ExtensionContext/call()
at com.mycompanyname.myappname::MyAppName/sendPing()[...
At the beggining I thought I had to do with the fact that I was using a DLL I compiled using the Debug configuration on Visual Studio instead of the Release configuration, because I read that sometimes the a debug-version of a DLL can use external DLLs. So, I changed it and rebuilt the whole library as a release build. Sadly for me, I'm still experiencing the same result.
Also, I tried changing the swf-version of both the AIR app and the ANE to the AIR SDK version I'm using (14.0), and got again the same error.
The development computer is running Windows 8.1 and the others, where the app is not working, Windows 7 and Windows 7 Service Pack 1.
Any ideas about why this is happening? Any questions or comments that might lead me to the right track will be deeply appreciated.
Error#3500 is coming because you don't have the required runtime installed on those machines, which is necessary to execute any c++ code .
On your development machine you have visual studio installed and hence you also have msvcr.
Solution of the problem is:
Install msvcr i.e. Microsoft Visual c++ redistribution - 2012 from here.
you need msvcr anywhere you want to run any VS compiled c++ code.

How to get Qt working on the blackberry playbook

I am completely frustrated because I have been trying to install Qt on Blackberry Playbook for over a month now. I have followed every single tutorial out there (so much that every time I google Qt and playbook, all links are purple instead of blue). I have downloaded Qt-everywhere source code and tried to compile it using the flags found here, but it tells me that it cannot install opengl, sqlite etc, so I use the --continue option with ./configure and that too crashes saying that it can't find qcc.
I have noticed a Qt library directory when browsing incudes in the qnx IDE, in the project explorer. The thing is when i write a Qt application it can't find the headers.
So Please Help, anyone who has done this in the RECENT past . ps. i am new to cross compiling on linux systems.
Probably quite late to say, but I have created a BlackBerry Native Plugin for Visual Studio 2015, where you can develop apps for BlackBerry PlayBook and Qt in particular.
Simply create new project "Other Languages / BlackBerry Projects / Qt / PlayBook - Qt4 Core Application" and you are ready to go. It downloads all required libraries via NuGet during first build.

0xE0434F4D Error

all, I have a rather frustrating issue. The application in question has an MFC GUI that uses the classes available in the MFC Featurepack. This GUI uses an DLL that is developed in C++\CLI. Our company uses Cruise Control. NET (1.4.4 SP1) on Windows Server 2008 SP2 for continuous integration. Cruise Control is setup to use the version of MSBuild that comes with the 3.5 version on the framework.
The issue in question is that if I use the build that Cruise Controls creates, I receive the following error: "Unhandled exception at 0x7642fbae (kernel32.dll) in FormView.exe: 0xE0434F4D: 0xe0434f4d." After some digging, the issue seems to be that the GUI doesn't like the C++\CLI assembly.
The "gotcha" is that if I log on to the server, and, using PowerShell, execute the same MSBuild command, the build works. Any one have ideas?
The issue was how I was building the installer. It was a separate solution from the project's main solution, and was thus a separate task from the primary build. Therefore, the output assemblies got signed twice, and loader complained because the one the application wanted was no longer valid.
you could try and attach the process to the visual studio debugger.