Qt: make and install module on non-host platform - android

I am developing an app using a QML-based module (https://github.com/papyros/qml-material) on OSX and would like to test the app on Android and iOS.
How do I set up the qmake file so that the module gets properly installed for the Android and iOS platforms (or, for that matter, any other non-host platform which I have in my Qt distribution) on my host system?
In this specific case, just copying the module folder to e.g. Qt/5.4/android_armv7/qml does not work as the module needs to install some QtQuick Styles and other stuff elsewhere as well.

I figured this out. Running the platform-specific qmake alone wasn't working because this project contained two subprojects, each one with its own Makefile.
It was sufficient to (re-)run the platform-specific qmake for each subproject and for the main project prior to running sudo make install.
So the bottom line is, make sure that the Makefiles that qmake generates for subprojects are updated for your target platform.

Related

`.gitignore` for an Ionic project with Android target

I'm creating an Ionic project using Capacitor (edit: the newer recommended framework compared to Cordova) and added Android as a target.
I've been able to build the app and add the Android target, which creates a bucketload of files under android/, using:
ionic build
ionic cap add android
Then, I was able to launch Android Studio and emulate my app, using npx cap open android, with "Run App" in Android Studio. This added a few more bucketloads of files.
I was able to get most of them to be ignored by adding the "ionic" and "AndroidStudio" gitignore entries from gitignore.io, but if someone clones the repo, they can rebuild the entire Android directory from scratch, right? Do I just consider everything in the android folder to be a build artifact that can be recreated from the core ionic project using capacitor (i.e. "cap").
Is there anything that needs to be saved to the repo in the ionic android directory? If so, which files - or should I fall back to ionic/Android Studio gitignore entries for the android folder?
Is there anything that needs to be saved to the repo in the ionic android directory?
I would suggest that you include your native folders in your repo as well.
Based on my experience with capacitor over the past year while developing two applications, consider these things.
Most of the times you will be using at least a few cordova plugins, since capacitor still doesn't have a viable plugin for certain features.
These plugins, will require you to manually add some variables ( like sdk keys ) or initialization function on the native side of the codes.
In fact, even for capacitor community plugins ( which are plugins created by other samaritans ), you will have to add some minimum lines of code to the native side. Consider this plugin for facebook sign in. Just go through the installation steps, you will see a long list of configurations on both ios and android sides.
Capacitor is not formerly Cordova. Both of these are different frameworks. Capacitor completely depends on native ide's for compilation, whereas cordova cli could build the native codes for you (ios, mac required).
but if someone clones the repo, they can rebuild the entire Android directory from scratch, right?
When your application grows, depending on its intended functionality, this would not be an easy task. They will have to go through all these minor tweaks to get it working.
All in all, put your native code in the repo as well. For me, the repository size with the native codes is not terribly huge.
In Capacitor you are supposed to commit the ios and android folders. They contain their own .gitignore files with the recommended files for iOS and Android.
They are not build artifacts, if you change icons or configurations (in Info.plist, AndroidManifest.xml, etc) and you delete the folders, those changes will be lost.
If you clone a Capacitor project you should run this commands:
npm install (or other install package depending on your package manager)
npm run build (or ionic build if using ionic)
npx cap sync (this copies files and generates non committed files)
As #jcesarmobile
In Capacitor you are supposed to commit the ios and android folders. They contain their own .gitignore files with the recommended files for iOS and Android.
But if you're looking for a .gitignore to use at the root of your project, this one should do the job.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.vscode
.idea
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Optional eslint cache
.eslintcache

How to change a project's name in Eclipse

How can I change a project's name in Eclipse?
Soong is a build system specifically for Android Platform development, and not Android app development, even though the Android Platform can contain regular Android apps built for the system image. That means Soong is not supported to use outside of Android Platform builds.
Your best bet here is to import/copy DeskClock's source code into Android Studio and write your own build.gradle files manually.

How can I do command line debugging using Android NDK

I am trying to debug a C++ Android application using Android NDK r20.
The project used to use the old way of building using ndk-build and the android.mk file.
Now the project is migrated to using gradle and cmake. Because of this, the ndk-gdb script no longer works, since it uses the old build system which expects an android.mk file.
So how am I supposed to debug from the command line using the latest ndk along with a gradle/cmake build system? Is there a new script that is provided?
ndk-gdb doesn't know how to do it out of the box right now. You can set up some symlinks in a gradle project to make the directory layout match a standalone ndk-build project which will let ndk-gdb work. See https://android.googlesource.com/platform/ndk/+/refs/heads/master/samples/NdkGdbSample/ for an example.
ndk-gdb doesn't work at all with CMake though.
See https://github.com/android-ndk/ndk/issues/1024 (I assume that's actually you that filed it). I don't know when we'll be able to do it, but what's described there is essentially what we'll do. We'll keep the existing script, get it to work with gradle projects, and (eventually) switch it to lldb under the covers.
Using Android Studio is your best bet for native debugging on Android right now.

How to completely disable NDK support in Android Studio

We have a multi-platform project, with native support, that we are developing in Android Studio using libgdx. We have builds working for Desktop, IOS, Android, Android Wear, and HTML5.
On each of these platforms, we have a different "native" plugin that we are using: a static .a native library on IOS, a .dll on Windows, a bunch of .so files in Android, and a Javascript library on HTML5. All of these, except for the HTML5 version, are built on separate platforms so can't possibly be built by the same Android Studio NDK build.
The problem is that for each of the .java files that declare JNI routines, Android Studio 1.4.x wants to find the source files, but those source files can't possibly be compiled in the IOS project, and likewise for the PC project when running on a Mac.
The standard solution on SO is to add
sourceSets {
main {
jni.srcDirs = [] //disable automatic ndk-build
}
}
To the android{} section, but this ONLY works for the Android, Android Wear launcher projects, and NOT Desktop, IOS, HTML5, etc.
I just want Android Studio to give up on trying to compile NDK, because it can't possibly be done on non-Android projects. Other than finding a downgrade somewhere, how do I do that?
Thanks!
So, I decided that I could figure this out - and I did!
Of course, the NDK builder is just a plugin in IntelliJ, so all you have to do to disable it is to
go to your AndroidStudio installation,
find the "plugins" directory
move or delete the "android-ndk" folder
Tada! No more NDK plugin!
Correct way is to uninstall NDK using SDK manager.
go to Android Studio-> Tools -> SDK Manager
Under SDK tools tab uncheck "NDK", "CMake", "LLDB" and then apply changes. NDK components will be removed.
Downside is NDK is removed for all project. Still struggling to find a way to disable NDK for a particular project only.
If you would like to keep the NDK build for future use and not use it for specific projects just make sure to uncheck these options in the new project dialog...

In Cordova/Phonegap why we need to build the project for each platform?

I created a new cordova project (from the command line, cordova create firstProject com.examplefirstproject FirstProject), then I added the platoform that I need (cordova platform add android) and at this point I read from the Cordova documentation that I need to build the project (cordova build android).
Why we need to build the project?
I tried to emulate the project without building it and it works fine. So, I'm asking why I should run the command to build the project.
The "only difference" from a project where I run the build command is the presence of more folders in firstproject\platforms\android (here is the list of folders and files of the not builded project and here is the list of the builded project).
The build command will recompile the app. There are many situations when this is important to do. Whenever, you make a change to core functionality of the app (not the HTML, JS, CSS etc), you will need to re-build the app for these changes to become apparent. Also, you will find when your project is finished, in order to publish the app you will have to build a release version of the app.
You don't need to build the app when you are merely editing the content of your app, which is what is causing your confusion it would seem.
It's also worth noting that when you use the 'run' command to emulate the app, this will also create a fresh build of the app.

Categories

Resources