larpon / QtFirebase

An effort to bring Google's Firebase C++ API to Qt + QML
MIT License
284 stars 83 forks source link

Running the project and take advantages of it for my own project #120

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello all,

I'm going to develop an Android app with the following description, but wanted to test this project on my Android device in advance to figure out what it does exactly! When built using the android kit on Qt Creator 4.9.1 on Windows, I get this error:

_FAILURE: Build failed with an exception.

My project description:

Simply, I want to develop an app for Android devices, front-end with QML and back-end with C++, when installed and logged in successfully, it can send packages to Firebase (with write/read access) and when not logged in, it has only read access to the packages. Each package is actually a set of data: a text, an int number and an image denoting a product (for instance: Name of product: "laptop TH 950", Price: $ 550, Picture: "The laptopโ€™s image").

Now my question is what exactly do I need to develop my app, please?

larpon commented 5 years ago

@Frankyth hey and welcome to the community ๐Ÿ‘‹๐Ÿ˜ƒ

I can't give much help regarding your project and can only say that QtFirebase and Qt development in general requires some programming experience - how much or how little is hard to say ๐Ÿ™‚

I can see that this message:

Firebase C++ SDK directory /home/lmp/Projects/QtFirebaseExample/extensions/QtFirebase/firebase_cpp_sdk does not exist

Indicates that you're trying to run the project more or less as-is - which is not going to work.

Have you read through the setup? Specifically I think you need to see the gradle section.

That path above is from my setup and need to be changed to match your project's setup. I'm guessing it's one of the gradle .properties files.

Maybe this file need to be corrected in your setup?

larpon commented 5 years ago

Sorry - hit the wrong button ๐Ÿ˜€

ghost commented 5 years ago

Hi And thanks so much. Wow, I must say I'm super glad that I can get rid of those numerous steps and files harder than "rocket science" and stick to this section

I found the file: D:\Projects\QML\QtFirebaseExample-master\QtFirebaseExample-master\App\platforms\android\gradle.properties. But how to open it to be able to edit it!?

Also I downloaded _firebase_cpp_sdk6.2.0 (unzipped 2.9 GB) and copied it to the Android SDK folder.

larpon commented 5 years ago

@Frankyth providing support on how to open and edit text files on your platform is beyond the scope of this project and not good use of the community's time.

Searching on Google and StackOverflow will get you very far in this regard.

I strongly suggest your get to know your platform and development tools before diving head-straight into projects like this ๐Ÿ™‚

ghost commented 5 years ago

Sorry. The files ended in .properties were new for me that was why I asked this.

My .properties file contains this: _systemProp.firebase_cpp_sdk.dir=/home/lmp/Projects/QtFirebaseExample/extensions/QtFirebase/firebase_cpp_sdk systemProp.ndkdir=/home/lmp/Environments/Android/android-ndk-current

There are two paths in the file. Should I edit it and give each its specific path to _firebase_cppsdk in SDK and NDK, respectively?

I did these: _systemProp.firebase_cpp_sdk.dir=D:/Qt_Stuff/Sdk/firebase_cpp_sdk systemProp.ndk_dir=D:/QtStuff/android-ndk-r19c

And now this error comes up! :(

_FAILURE: Build failed with an exception. What went wrong: A problem occurred configuring root project 'android-build'. Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;27.0.3 Android SDK Build-Tools 27.0.3 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html Using Android SDK: D:\QtStuff\Sdk 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

larpon commented 5 years ago

Sorry. The files ended in .properties were new for me that was why I asked this.

It wasn't meant as something rude - just a reminder to try out your options before asking :smiley:

The error you're getting comes from the Android SDK (I.e. not QtFirebase related) - and as it says you need to agree to some licenses - this is something all Android developers must do. Try Google for the specific lines in the error message

ghost commented 5 years ago

Yes, it was done and nearly reaching the end to create the APK file but showed this error:

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':transformClassesWithMultidexlistForDebug'. com.android.build.api.transform.TransformException: Error while generating the main dex list. 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

I'm not sure what modification is the right one to choose for the file build.gradle to get rid of this last difficulty and whether it's also right for the forthcoming projects I will probably be dealt with.

ghost commented 5 years ago

I made these changes: 1) Edited the file local.properties to this: _ndk.dir=D:/Qt_Stuff/android-ndk-r19c sdk.dir=D:/QtStuff/Sdk

2) Changed the file build.gradle from:

implementation 'com.google.firebase:firebase-core:16.0.1' implementation 'com.google.firebase:firebase-messaging:17.1.0'

To:

implementation 'com.google.firebase:firebase-core:15.0.2' implementation 'com.google.firebase:firebase-messaging:15.0.2'

And the re-built the project using the Android Arm7 kit. Still the same error! :(

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':transformClassesWithMultidexlistForDebug'. com.android.build.api.transform.TransformException: Error while generating the main dex list. 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

As well as, I have the following error in all .qml files where Firebase is imported: import QtFirebase 1.0 (QML module not found - QtFirebase)

Why should that project be that complicated just to build!? It's really astonishing.

larpon commented 5 years ago

Why should that project be that complicated just to build!? It's really astonishing.

Because you're relying on a huge stack of software - and software is not always straight forward :slightly_smiling_face:

What version of Java have you installed on your system?

ghost commented 5 years ago

Dear Larpon, I'm myself a programmer of C++ which is the most complex (and best) programming language, so I'm not a newbie in this case! What I say is, almost all projects I've downloaded on GitHub have not made the tester go through several steps just to run the project! :)

Probably here is where I lack enough experience. :(

Anyhow, back to the question: I think this image gives you the info on all my Android settings: https://imgur.com/gpsnSPe

larpon commented 5 years ago

Sorry, the picture is too lowres for me to see the Java version from.

FYI You can paste images directly on GitHub input fields instead of using 3rd party services like imgur.

larpon commented 5 years ago

Anyway that error message can be because you're running a Java version < 8. Gradle rely on Java

ghost commented 5 years ago

Ow, right. Thanks. From now on I will upload my images right to here! :) The Java version my Qt Creator is using is: jdk1.8.0_211. Should I use a more updated version of it?

larpon commented 5 years ago

Should I use a more updated version of it?

JDK 1.8.x should be fine. The problem is maybe somewhere else then.

ghost commented 5 years ago

I really don't know where to seek more! :( There's also this module error in all qml files. Here in Main.qml:

3

larpon commented 5 years ago

I can see from that screenshot that QtFirebase is not getting included. Please check the path to qtfirebase.pri in the App.pro file...

ghost commented 5 years ago

Here is the part where qtfirebase.pri through a path is included. I just downloaded the project and saved that after unzipping, but can't find a file named "qtfirebase.pri" in the project's directory!

...
# Includes QtFirebase:
include(../extensions/QtFirebase/qtfirebase.pri)
...

There's only one .pri file in the extensions folder named "gitversion"!

larpon commented 5 years ago

Exactly

ghost commented 5 years ago

1) So it is included. Then why is there that "not found" error there and why can't I build the project successfully, please?

2) I also just thought of the api level for the android build. It's 29. Could it be the source for the error "Execution failed for task ':transformClassesWithMultidexlistForDebug'." error?

3) Also one other question: Is it the only example Firebase is used in QML in the world? If there's a simpler example I can run and figure out properly and probably take benefits of that form my own project, I had better go for that instead.

SobolevWladimir commented 5 years ago

Hey. I have the same error. Execution failed for task ':transformClassesWithMultidexlistForDebug'." error There is a solution ?

larpon commented 5 years ago

Try using Firebase C++ SDK v6.1.0

See thread here