• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Running Qt C++ files in Android Studio

Karman15

Lurker
Dec 29, 2022
1
0
Hi, I am trying to create an app for local machine translation. I have a GUI for it. I need to embed a QT desktop project as a library in order to use some functionalities of that project.

For now I just have one Qt C++ file in order to check if running Qt files in Android Studio is even possible but I keep getting errors. I was wondering if anyone could help me with this. Thanks!
I'm pasting the build output of the most recent error that I got:

Executing tasks: [:app:assembleDebug] in project C:\UNI\4th_Year\Thesis\translateLocally for Android

> Task :app:createDebugVariantModel UP-TO-DATE
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:dataBindingMergeDependencyArtifactsDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:packageDebugResources UP-TO-DATE
> Task :app:parseDebugLocalResources UP-TO-DATE
> Task :app:dataBindingGenBaseClassesDebug UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:mapDebugSourceSetPaths UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugMainManifest UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugManifestForPackage UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:compressDebugAssets UP-TO-DATE
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:mergeDebugJavaResource UP-TO-DATE
> Task :app:checkDebugDuplicateClasses UP-TO-DATE
> Task :app:desugarDebugFileDependencies UP-TO-DATE
> Task :app:mergeExtDexDebug UP-TO-DATE
> Task :app:mergeLibDexDebug UP-TO-DATE
> Task :app:dexBuilderDebug UP-TO-DATE
> Task :app:mergeProjectDexDebug UP-TO-DATE
> Task :app:configureCMakeDebug[arm64-v8a]

> Task :app:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: fatal: CreateProcess: Access is denied.

> Task :app:configureCMakeDebug[armeabi-v7a]

> Task :app:buildCMakeDebug[armeabi-v7a] FAILED
C/C++: ninja: fatal: CreateProcess: Access is denied.

> Task :app:configureCMakeDebug[x86]

> Task :app:buildCMakeDebug[x86] FAILED
C/C++: ninja: fatal: CreateProcess: Access is denied.

> Task :app:configureCMakeDebug[x86_64]

> Task :app:buildCMakeDebug[x86_64] FAILED
C/C++: ninja: fatal: CreateProcess: Access is denied.

> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:writeDebugAppMetadata UP-TO-DATE
> Task :app:writeDebugSigningConfigVersions UP-TO-DATE

FAILURE: Build completed with 4 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\UNI\4th_Year\Thesis\translateLocally for Android\app\.cxx\Debug\z595a5g4\arm64-v8a'

C++ build system [build] failed while executing:
@echo off
"C:\\Users\\karma\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
-C ^
"C:\\UNI\\4th_Year\\Thesis\\translateLocally for Android\\app\\.cxx\\Debug\\z595a5g4\\arm64-v8a" ^
translatelocally
from C:\UNI\4th_Year\Thesis\translateLocally for Android\app
ninja: fatal: CreateProcess: Access is denied.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:buildCMakeDebug[armeabi-v7a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\UNI\4th_Year\Thesis\translateLocally for Android\app\.cxx\Debug\z595a5g4\armeabi-v7a'

C++ build system [build] failed while executing:
@echo off
"C:\\Users\\karma\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
-C ^
"C:\\UNI\\4th_Year\\Thesis\\translateLocally for Android\\app\\.cxx\\Debug\\z595a5g4\\armeabi-v7a" ^
translatelocally
from C:\UNI\4th_Year\Thesis\translateLocally for Android\app
ninja: fatal: CreateProcess: Access is denied.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:buildCMakeDebug[x86]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\UNI\4th_Year\Thesis\translateLocally for Android\app\.cxx\Debug\z595a5g4\x86'

C++ build system [build] failed while executing:
@echo off
"C:\\Users\\karma\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
-C ^
"C:\\UNI\\4th_Year\\Thesis\\translateLocally for Android\\app\\.cxx\\Debug\\z595a5g4\\x86" ^
translatelocally
from C:\UNI\4th_Year\Thesis\translateLocally for Android\app
ninja: fatal: CreateProcess: Access is denied.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:buildCMakeDebug[x86_64]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\UNI\4th_Year\Thesis\translateLocally for Android\app\.cxx\Debug\z595a5g4\x86_64'

C++ build system [build] failed while executing:
@echo off
"C:\\Users\\karma\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
-C ^
"C:\\UNI\\4th_Year\\Thesis\\translateLocally for Android\\app\\.cxx\\Debug\\z595a5g4\\x86_64" ^
translatelocally
from C:\UNI\4th_Year\Thesis\translateLocally for Android\app
ninja: fatal: CreateProcess: Access is denied.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
40 actionable tasks: 8 executed, 32 up-to-date
 
the issue you're facing is related to the build process of your Android app. The error message "fatal: CreateProcess: Access is denied" suggests that your build system (ninja in this case) doesn't have the necessary permissions to execute the build process.

To resolve this issue, you may need to run the build process as an administrator on your machine. You can also check to ensure that the necessary dependencies are properly installed and configured, and that your build system has the correct path to the dependencies.

Another thing to keep in mind is that Qt is not a framework that is natively supported by Android. To use Qt in an Android app, you will need to use a tool like Qt for Android, which allows you to build Qt applications for Android devices. This tool provides a set of libraries and tools that will allow you to use the Qt framework in your Android app.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones