QTcreator building simple qt project with android profile - java

I'm trying to build simple Qt project with android profile, but receiving strange error:
Android_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug/android-build/src/org/qtproject/qt5/android/bindings/QtApplication.java:46:
error: duplicate class:
org.qtproject.qt5.android.bindings.QtApplication public class
QtApplication extends Application
after androiddeployqt run

Right, I'm going to assume this is the same as what has happened to myself:
You've upgraded Android Studio which has broken the Qt build for Android.
You've managed to solve the issue of upgrading gradle, resolving previous errors. ie from here
Now you're getting 'error: duplicate class'.
Solution:
When Qt builds the project all files are stored in 'build-myappname-Android_for_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug
Delete that folder and rebuild the project.
You may need to clean and rerun qmake, but I doubt that is required. I only do that out of habit.

Related

Android Studio not working after Reinstall

I've been having some struggles with building my app after Reinstalling Android Studio. The cues I've gotten have been related to either Java location or installation. With the jre already installed it seems more likely not to be an issue with JAVA.
I've tried importing my project, copy and pasting from .txt files, reinstalling java, redefining java PATH, changing build dependencies, downloading command line sdk manager to build outside of the ide, erasing build caches, and I also let Android Studio rewrite properties.profile when importing Android Studio Project.
Another strange thing, when I create a directory in the project structure it shows up when the ide is initiating before gradle builds. After gradle builds the folder is no longer visible.
EDIT
error: package R does not exist
error: cannot find symbol class appcompat
UPDATE
This seems like a common problem. I've tried to follow most of the current questions on java incompatiblity but still haven't come up with a work around. I downloaded oracle's jdk (unnecessarily) and pointed the studio project at it. Created a shortcut using the jdk java.exe and placed it in Studio core, added java to the PATH which allowed gradlew build in the terminal to initiate but not complete. What are the next steps?
UPDATE
Just in case somebody else stumbles onto this. This post and also this one got me there.
The fix ended up being an import of the .R file. com.example.android.recyclerview.R Hope it can help

Android APK invalid? Didn't find class "AndroidLauncher" on path: DexPathList

I'm getting the following error when I try to run my App on my SmartPhone:
Didn't find class "munyul.game.android02.android.AndroidLauncher" on path: DexPathList
Due to HD issues, I was forced into rebuilding my machine and setting up my developed environment again. After a lot of messing around, I have the following installed and working:
Java 1.8
Eclipse Neon
libGDX
Android SDK Manager
The Android App in question was almost finished, but now that goal seems like a long way off :(
I used libGDX to create a new project, and then I copied the old code into the new project - this is where things got messy.
I had to fix several errors caused by changes in libGDX, which was easy. I then also had to fix several errors caused by changes to Google Services, this was not easy! I eventually read about the new m2repository folder, then I searched for and found the class files needed (play-services-ads, -base, -basement, -games and -plus, inside .aar files), placed all the classes.jar files into their own directory within the android/libs project folder, finally adding references to them from within Eclipse - now everything compiles and looks good (should these .jar files be checked for export? - see edit)
Finally, I had to make one more change; the old project/code was created with a package: munyul.game.android02.android, but the new only had munyul.game.android02, I added the missing package to the new and also updated the AndroidManifest.xml file (maybe this is what went wrong!?).
I've checked the code and manifest and everything looks correct, but when I run the App it instantly crashes with the above mentioned error.
Also, I've checked the Order and Exports for the android project, the boxes that should be checked are.
Anyone know what else I could try?
EDIT:
As a test, I checked the Google Services JAR's for Export, and now I'm getting a different error:
Could not find class 'android.support.v4.util.ArrayMap', referenced from method
com.google.android.gms.common.api.GoogleApiClient$Builder.<init>
I'm starting to think that my error lies with how I resolved my Google Services issues - is there a better way of linking the missing classes? Somehow adding them via Gradle?
EDIT #2:
I migrated the entire project to Android Studio - now the APK installs and runs correctly on all my devices.
Honestly, I would have prefered to stick with Eclipse, but it seems like that is no longer an option - HTH
Check your AndroidManifest.xml for the correct application class (or none if you are not overriding.) The AndroidLauncher is part of the "instant run" feature available in Android Studio and is automatically injected by gradle into the manifest file.
Eclipse is no longer a supported development toolchain - you'll want to do your migration to Android Studio (or IntelliJ) sooner rather than later.

All of a sudden. Can't build my project(Game) & sync with Gradle (Libgdx)

So, i've been developing several Games for Android.
And im currently working on an update for my latest game.
I shut down my computer normally yesterday, no problems & no errors...
... Today when i logged into Windows & opened my project in Android studio i get this strabge error:
Gradle 'projectname' project refresh failed
Error:Cause: org/apache/commons/io/FileUtils
I don't know whats causing this error...
I can open my old project(game created with libgdx) and it works just fine.
But when i open my recent one it wont compile & gradle wont sync.
Even if i create a new project it will give me the same error.
Google Doesn't say anything about this :(....
what i've done to try fixing:
Reinstalled Android Studio
Removed all Java Version. JDK + JDE.
Updated All SDK, Raspitory, Google Play services, etc..
As my old project was created exactly in the same way & works, i find this very frustrating. The only things that is different from my new project is that my old game is created in an older version of Libgdx, older Version of Android Studio etc...
What's strange is that it all worked just fine yesterday!
Anyone?
i'm desperate. Put so much time into this project!
Try removing downloaded gradle dependencies for org.apache.commons.io from your system and rebuild the project. The downloaded dependencies can be found in .m2 folder (In linux it will be a hidden folder in home directory)

"java: package org.apache.cordova does not exist" when compliling Cordova in Android Studio

New to android dev world and am just getting started here, well trying to anyway. I've downloaded Cordova (2.8, might need to upgrade this), Java JDK (1.7), and the new Android Studio, the Andriod SDK, installed all the 4.x packages with that, and installed ant (1.9.2).
Everything seems to be working as far as that goes. Problem is when I can create a Cordova project, from the command line, load it up in Studio using the import feature, not tweaking anything, just accepting (as I read to do so on some blog out there) and everything seems to load ok and the project is there in Studio, until I try to make it. At this point, I get and error "java: package org.apache.cordova does not exist" This is followed by several other errors, which I feel may be related. I'm not nor am I trying to do anything fancy here, just get the stock up and running.
Anybody know what I'm missing? Do I need to copy a file somewhere or compile something extra? Or am I using the wrong version of something?
Thanks!
I found after hours of searching and trial and error (although mostly errors) I came to find that it was all due to missing the cordova-*.jar file. which needed to be built using the ant jar in the framework folder of my android cordova directory. This step had been majorly left out of a ton of documentation. Once built, I simply copied this into the 'libs' folder of my project and everything loaded up and ran, although I did get a warning about depreciated project from the compiler, creating an ant build and selecting 'external compiler' fixed this warning.
Android Studio uses Gradle project layout. This means main java files should be in /src/main/java. If Cordova generates different structure (it looks like it is old Ant structure) you need to add its source folders to build.gradle
android {
...
sourceSets {
main {
java {
include 'some/wanted/package/**'
include 'another/wanted/package/**'
exclude 'some/unwanted/package/**'
}
}
}
}
Here is where the file sits:

Using Gradle in Android Development

Im new to android development and ive seen some old tutorials before regarding its development on Eclipse. i recently download the new Android Studio to use for the development. However, i found something new called gradle files that are present in the projects folder along with the normal files that used to be in the project.
Everytime i try to run the app i get the following error:
"
Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assemble' not found in root project 'SampleProject'.
* Try:
Run gradle tasks to get a list of available tasks.
"
Could anyone please explain whats the use of gradle? and do i have to use it while developing android apps?
Thank you
Version 0.2.1 of Studio was just released and provides a better error. You should upgrade and see what happens, but it's likely that your project has another problem that should be fixed instead of randomly adding a task that shouldn't be added.
In your top directory file with name build.gradle just put:
task assemble {}
You can see it in known issues here
Get started with gradle here!
Edit: Android Studio 0.2.1 solves this error: http://tools.android.com/recent/androidstudio021released
Android Studio is bleeding edge (not yet beta).
For more stable solution use Eclipse with ADT, e.g. ADT-bundle http://developer.android.com/sdk/index.html
You can develop in Eclipse with ADT and run Gradle build using Nodeclipse/Enide Gradle for Eclipse
(marketplace)
Some screenshots for Gradle for Eclipse:

Categories