How to combine qt(necessitas) with SDL on android? - android

I am using Qt on android through necessitas port.
I'm trying to combine Qt with SDL.
When compile such project with SDL invoked (SDL_Init) , compiler gives me error : multiple definition of `JNI_OnLoad'.
LOG : /mnt/sdcard/Android/data/com.n0n3m4.droidc/files/gcc/bin/../lib/gcc/arm-linux-androideabi/4.7.1/../../../../arm-linux-androideabi/lib/libSDL.a(SDL_andvideo.o): In function JNI_OnLoad':
SDL_andvideo.c:(.text+0xddc): multiple definition ofJNI_OnLoad'
qtmain_android.o:qtmain_android.cpp:(.text.JNI_OnLoad+0x0): first defined here
Is there some short way how to solve this ?
specific : compiling on C4droid (ide from google play with gcc , necessitas Qt(gui + core) , SDL plugin)
thanks

You should ask the developer of c4droid. Looks like he's a helpful guy. He says on google play you should contact him if you have trouble.

Related

Can not use Vulkan Subgroup operations in Android Studio

I'm writing a Vulkan compute shader in Android studio and launching it on Android phone. The problem I'm experiencing is next - I can not use any subgroup operations like subgroupAdd and subgroupElect. When I'm trying to use these functions I have an error like this:
reduce_vec.comp:35: error: 'subgroup op' : requires SPIR-V 1.3
I have checked - my Android phone supports subgroups, and my shader accepts such extensions:
#extension GL_KHR_shader_subgroup_arithmetic: enable
#extension GL_KHR_shader_subgroup_basic: enable
The problem is pretty much straightforward, I need to update my SPIR-V. But according to my findings, SPIR-V that comes automatically with Android studio is not something I can update easily.
Did someone experience a similar issue before? What was your solution? Thanks in advance!
Android solution
You can pass arguments to the Android shaderc compiler in your Gradle DSL:
https://developer.android.com/ndk/guides/graphics/shader-compilers
You need glslcArgs to contain --target-env=vulkan1.1
Flexible solution
Build your own compilation pipeline to compile from source into SPIR-V, and then include the SPIR-V binary files directly into your Android project.
There are multiple language front-ends that can generate SPIR-V, for GLSL the Khronos tools are here:
https://github.com/KhronosGroup/glslang

Print C stack trace on Android 5/Lollipop

I'm trying to debug JNI code written in C running on Android 5. When one of my functions is called, I want to write a stack trace to the adb log so I can see where the function was called from.
The first resources I found indicated I needed to use libcorkscrew, and included complete examples of how to use the library. Unfortunately it seems libcorkscrew is gone from Android 5, and now libunwind is supposed to be used. For my project, there are several problems:
Instructions for getting libunwind into the project are sparse and/or misleading - some resources say to download the project from github and build it (with directions that do not work), others indicate the library is already part of Android 5.
All of the examples are written in C++, and it seems that libunwind only has C++ bindings for the functions within it. Since my code is C, not C++, and writing to a log function rather than through the C++ stdlib, this isn't usable.
Among others, I looked at these pages:
Native Stack Traces on Android Lollipop with libunwind
There's no "libcorkscrew" in Android 5.0...
Android NDK: getting the backtrace
Is there a way to get a stack trace in C code on Android 5 without crashing the program?
Instructions for getting libunwind into the project are sparse and/or misleading
Compiled libunwind is included into modern Android NDKs, such as NDK r16b, at sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a. You will have to provide this file to the linker. You will also need to download matching headers, namely libunwind.h and __libunwind_config.h. For NDK r16b, these headers can be fetched here: https://android.googlesource.com/platform/external/libunwind_llvm/+/ndk-r16/include/ .
it seems that libunwind only has C++ bindings
No, it's not so. Most of libunwind bindings are C bindings.
Here is a sample Android command-line app in pure C that uses libunwind:
https://github.com/alexeikh/android-ndk-backtrace-test
Can you use backtrace_symbos_fd at Android? If you can, you could use this one:
void *array[100];
size_t size;
size = backtrace (array, 100);
backtrace_symbols_fd (array, size, STDOUT_FILENO);

NUnitLite in Xamarin (Android). Unable to load Mono.Data.Sqllite.dll

I'm currently experimenting with Xamarin for the first time, as well as NUnitLite for the first time. I've set up a small Android project and a test project. In the Android project I make use of SqlLite, and in my test project I want to write some integration tests for my database insert/update/select methods.
However, when I run tests which includes a call to my class "GroupRepository" (which includes a type from the Mono.Data.Sqllite.dll in its constructor) I get the following exception. Note that I've also added the mentioned dll to my test-project.
TestInsertWithLegalValues (IntegrationTests.Repository.RepositoryTests.TestInsertWithLegalValues)
System.IO.FileLoadException : Could not load file or assembly 'Mono.Data.Sqlite, version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
----> System.Security.SecurityException : Strong name validation failed. (Exception from HRESULT: 0x8013141A)
at Repository.GroupRepository..ctor()
at IntegrationTests.Repository.RepositoryTests.SetUp()
--SecurityException
The Android project targets API 8 using Xamarin 2.0. The test project is a Windows Console Application .NET 4.5.
Why is this failing the way it is?
Thanks for any input!

How to play Audio file in Android QT?

i developed my application in QT, i am trying to port for android. my application working fine in android with few issues. the main issue is, i am not able to play the audio file when i am trying to put the audio file play Code i am getting error
QSound::play(FilePath);
Error: : -1: error: error: cannot find -lQtMultimediaKit
D:\Projects\test\demo.cpp:996: error: undefined reference to 'QSound::play(QString const&)'
my config: QT 4.8,QT Creator 2.5.83 and necessitas and windows XP
i am able to include the QSound Header file and using intellisense to type the QSound::Play no issue while typing when i am getting error on compilation. so i tried to look into the source folder and i found QSound.h header also.
How to play the Audio file in Android using QT?
in may case it works properly with no errors
my code:
player->setMedia(QUrl("qrc:/new/prefix1/1.mp3"));
// ok it works on windows
//also works on android
Stumblend in this one while searching info, this looks useful: http://qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html
While the support of Audio for Android in QT is there, it's a journey through hell with the current release. If you want it stable in the end you'll end-up searching for external libraries anyway Take a look here
this works for me
file .pro
QTPLUGIN += qtaudio_coreaudio
QT += androidextras
QT += widgets
QT += quickcontrols2
file in Resources:
player2->setMedia(QUrl("qrc:/new/prefix1/folder_x/file.mp3"));
player2->play();

Problems with build.xml when using the Android ADK to communicate with an Arduino Mega ADK

So a few days ago I got my hands on an Arduino Mega ADK board, and the last couple of nights I have been setting up my development environment, getting to grips with the tools etc. The tools and libraries all work fine, for example I can get a program written in the Processing IDE to compile and run on an Asus Eee Pad Transformer TF101 running Android 4.03. But when I get it to try to compile and run one of the pre-written examples, it gives me a compiler error:
Android SDK Tools Revision 20
Installed at C:\NVPACK\android-sdk-windows
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:680: The following error occurred while executing this line:
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:693: Compile failed; see the compiler error output for details.
Total time: 7 seconds
And that's all the console seems to output as well, which is rather frustrating! As far as I'm aware all of my SDK versions, tools and plugins are all up to date. I've tried this using a Linux partition I have on my hard drive and it produces the same error message, although it mentions a problem with the package com.Android.future.UsbAccessory. Given what I've seen, it seems that the problem is with the tools, either my directory structure doesn't match up to what the correct setup is, or something else is wrong :S. If anyone has had similar problems, some help would be smashing! (For the record, my setup was done using the instructions on the Arduino website, although I already had the Android SDK tools installed).
Will Scott-Jackson
It sounds like your haven't added in the support library to your project and/or you haven't downloaded it into your Android SDK.
The ADK1 demokit app targets API Level 10 (Android 2.3.3); That means you need to use the support libraries in your project and that's why the compiler is complaining about level 10 library dependencies not being available. The support libraries are a separate download in the SDK Manager, so you might not have them in your development environment.
In Android API Level 12 and higher, the USB Accessory protocol was added to the framework API, so there are two different ways to use the accessory protocol. So, you don't have to use the support libraries if you are targeting Honeycomb and higher versions, but you'll have to update the demokit app code to make this work.
Hope this helps.
So I've double checked my setup and started working on a project I had in mind, it seems to import the libraries appropriately. So far so good, but when I input:
ArduinoAdkUsb arduino;
void setup() {
arduino = new ArduinoAdkUsb(this);
//Other UI initialisation etc.
}
I get this error:
##name## ##version## by ##author##
FATAL EXCEPTION: Animation Thread
java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
at cc.arduino.ADKCommunication.<init>(Unknown Source)
at cc.arduino.ArduinoAdkUsb.<init>(Unknown Source)
at
processing.android.test.sketch_120730a.
sketch_120730a.setup(sketch_120730a.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
After the app has been built and installed onto the Android tablet I am using. Any thoughts how I can over come this? From what I can tell, this has no problem finding com.android.future.usb.manager to compile and install the program, but once it tries to run it can find it.
Based on this tutorial from http://stream.tellart.com/controlling-arduino-with-android/
In the examples RGB_Arduino the name, version and author variables are set at the top of the sketch.
Try adding in this section of code at the top of your arduino sketch just underneath the library imports
// accessory descriptor. It's how Arduino identifies itself to Android
char applicationName[] = "Mega_ADK"; // the app on your phone
char accessoryName[] = "Mega_ADK"; // your Arduino board
char companyName[] = "Freeware";
// make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "http://labs.arduino.cc/adk/"; // the URL of your app online
//initialize the accessory:
AndroidAccessory usb(companyName, applicationName,
accessoryName,versionNumber,url,serialNumber);

Categories

Resources