I have error while compiling project in Qt - android

I have project created in Qt4.x and now I'm compiling this project on Qt5.3.1.
The project compiles well for Windows but when compiling for Android I get following error
:-1: error: No rule to make target '........\Softwares\Android-SDK-NDK-ANT\android-ndk-r9d-windows-x86_64\android-ndk-r9d\sources\cxx-stl\gnu-libstdc++\4.8\include\profile\impl\profiler_map_to_unordered_map.h', needed by 'ui_main_window.h'. Stop
Please help,
Thanks in advance

That's most probably related to this bug which is also discussed in this blog post. You are on Windows (first hint) and your NDK path seems quite long (second hint). These facts, combined with the long paths Qt Creator tends to create, generates paths that long to hit OS limits and then strange and cryptic errors can pop out of no where.
Quoting directly the linked post:
Try installing the NDK directly in the root with a short directory name, and have a shallow directory structure for the project you are building. If you still have problems, try turning off shadow building, as this appends a long directory name to your path.
Personally I've:
C:\AdtBundle\sdk
C:\AdtBundle\ndk9d
C:\Ant (a lot of deploy errors occur for a bad decision about Ant directory path...)
After setting such simple directory structure I've never encountered any strange error due to excessively long/bad paths.

Related

Android libGDX: Eclipse crash when using google-play-services_lib

I'm learning how to make games in libGDX, and I'm trying to add ads to my game.
I'm following this tutorial:
https://www.youtube.com/watch?v=cwAN4LMXo58
(I'm using Eclipse instead of Android Studio).
I got stuck at 9:35 of the tutorial; I've copied all the code and everything seems to look good; but when I try to run the code, nothing starts; Eclipse just keeps loading until the following error pops up:
Unable to execute dex: GC overhead limit exceeded
GC overhead limit exceeded
It seems to be the same problem as this guy had:
Importing "google-play-services_lib" into Eclipse crashes libgdx project
But I followed all the suggested steps and Eclipse still crashes... (I seem to have too little reputation to comment on that post).
Eclipse didn't crash before, when I didn't select google-play-services_lib in Properties - Android (after right-clicking the android project), but had it selected in Properties - Java Build Path ; but then there was a different problem (which I've partly forgotten), I believe the class AdView couldn't be found or something (sorry for not being to able to be specific).
I'm using Eclipse Luna. I've tried to make a new project just to try everything a second time; same problem.
Please tell me if it would help to post other information! :)
This issue is related to your VM options which you can change in your Eclipse.ini file. I don't know your default values but if you increase -Xms and Xmx limits, your problem will be fixed.
...
-Xms1024m
-Xmx1024m
...

How do I fix Eclipse CDT Error "Function 'isdigit' could not be resolved" with Android NDK?

I am using Eclipse Indigo with an Android/NDK mixed project. I've added C++ nature and almost everything is working. Automatic builds work; that is, when I edit a file ndk-build is invoked and completes successfully - no build errors. Mouseover code assist works (the little window pops up with information about the function). If I place the cursor on an include line and press F3, a relevant header file open (not the one I would expect based on my configuration, but a relevant one - maybe a clue?).
If I select the following line in my .cpp file, it opens $NDKROOT/platform/android-3/arch-arm/usr/include/ctype.h:
#include <ctype.h>
(isdigit is defined in this file)
However, Eclipse insists that isdigit is not defined. I have read many posts suggesting that either the static analyzer or the indexer is to blame, but I've tried many of the suggested solutions to no avail.
If I add a line like the following, the error goes away and mouseover code assist for the function works:
extern int isdigit(int);
Again, this is not a linker error or a compiler error - ndk-build completes with no errors. This is something inside eclipse. Thanks for taking a look!
Edit: I now believe this to be a Code Analysis problem. A better solution is to edit the Code Analysis options to make "Function could not be resolved" be a warning instead of an error. That way you can see the warnings in Problems view, but continue to work. If the function is REALLY missing, the compiler will tell you! I also have a new theory, that the problem is with the Code Analyzer following symlinks, because all of the "missing" functions are in symlinked include files. Would love any input on this theory.
After spending several days working on problems like this, I developed the following recipe for dealing with issue.
I hope it helps you or others:
Summary: Usually, your problems in eclipse are due to eclipse configuration problems. The following assumes that your C++ code is building ok with ndk_build or ndk_build.cmd (on windows).
No joy with eclipse juno (4.2) and CDT version 8.1. Use eclipse indigo (3.7)
Make sure that you have the CDT for indigo installed and enabled (version 8.0X) by looking in the "install new software". It defaults to installed but not enabled on indigo on some downloads.
When you are dealing with native code or android config for native code, make sure you are in the C++/C perspective in eclipse, not the java one. It is deceptive, but there is a only a subset of options available in Java perspective. You can be sure you are C++/C perspective if you see "C/C++ general" as a choice when you do "Project > Properties."
The usual problem is that the indexer in C/C++-land thinks there are errors when there is not (e.g. building with ndk-build works ok, often you can see this in the console window even). This is caused by bad paths in the "Paths And Symbols" part of "Project > Properties > C/C++ General" on the first tab.
To fix the problem, the primary tool is to right-click on the project, select "Index" and "Search for unresolved includes." This will tell what files it can't find--and these are typically not the ones that you have in your files with the little pink mark by them.
To find the right file, search in your NDKROOT directory (where you installed NDK). A typical one to add is: ${NDKROOT}/platforms/android-9/arch-arm/usr/include or the right android-N for your android target. There are many copies of the standard include directories in the NDK because of multiple versions of android and copies of the C++ standard libraries.
Two big warnings
The "unresolved includes" view in eclipse does not automatically update when you change the indexer configuration on the Properties > C/C++ General/Paths and Settings so be sure to run it again each time. Most views in eclipse do this update properly!
Also the little red/pink error markers in the source code views in the eclipse editor don't automatically update either. You have to "touch" the file in some way for it discover that the error is now fixed.
I worked around this issue via the approach I suggested in my question and haven't been able to find a better way yet.
Perhaps this will help:
Go to Project > Properties
Navigate to C/C++ Build > Settings
Go to GCC C Linker > Miscellaneous settings
Add the following in the Linker flags : -lc
Have you tried rebuilding the indexer? (right click project in project explorer index->rebuild)
Sometimes that takes care of problem... If you upgraded from an earlier version of eclipse your indexer setup could be a problem -- you might want to try restoring the indexer defaults (preferences c/c++ Indexer)... Hope this helps – this issue can be 'maddening' (seems to happen way to often)
I had the same problem on Linux with different toolchains. Even the simplest C++ code (like the one create by the hello wizards) would have syntax errors, without aby build problem. As pointed out in another post by Thorbjorn Jemander the problem is in the indexer and it can be eliminated by deselecting the option "Allow heuristic resulution of includes". Explicitely: Winsow -> Preferences -> C/C++ -> Indexer -> deselect the above option.
After that you may see that highlighted errors disappear after you open the file in editor and just click within the editor page...

Conversion to Dalvik format failed with error 1 with javax/net/SocketFactory.class

Encounter this problem when trying to Build Project getting such output in console:
[2010-07-19 23:29:23 - myProject]
trouble processing "javax/net/SocketFactory.class":
[2010-07-19 23:29:23 - myProject]
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2010-07-19 23:29:23 - myProject] 1 error; aborting
[2010-07-19 23:29:23 - myProject] Conversion to Dalvik format failed with error 1
I was looking for my project to use the package javax, not found, clean all also does not help. what I am doing wrong?
Update
Sorry guys, but I could not find good fix for that, I want to emphasize the fact, that i dont use SocketFactory class in my project at all! source code was not changed before this problem, and that's why i think that problem in eclipse or adt or something else, BUT if i use ant(generated by sdk) to build this project there is no problem!!!
I solve this problem by removing Eclipse, Android SDK, Eclipse workspace, and just reinstall them, after this all works fine for now.
Hope this will help someone.
I had the same problem..
This worked for me
project-->properties->java build path->libraries-> remove all including android jars
now go the project browser, right click on the project you are working on,
then android tools---> fix project properties...
do a clean and then build...
I solved the problem (at least for me).
Here's what I did:
Go to Project » Properties » Java Build Path » Libraries
Remove all except the "Android X.Y" click OK.
Go to Project » Clean » Clean projects selected below » select your project and click OK.
That did the trick for me.
Hope it works for you as well
Update: well actually I might have to retract my opinion.. the actions removed the error messages but now I am missing certain classes and methods... arggghhhh
I just restarted Eclipse, and the error didn't appear anymore!
I had the same problem,and solved it as follows:
First clean all jars; (This problem must because your some jars)
Delete the project;
Reimport project;
Make sure your sdk is right, and project select one sdk version;
(This is my issue to solve the problem) Right click your project, and select "build-path", next select "add Librarys", and add your private jars;
clean-build, the problem has fixed;
I just had the same problem and I tried all of the solutions listed here with no success (I was starting to get annoyed). Then I removed the project from the workspace and then imported it again, and there were no problems!
This happened to me this way,
I have a quite an old project which I had to start working again today. I use 'Universal Image Downloader' library for basically every project where I have to deal with lots of images. So in this old project I had the source files of 'Universal Image Downloader' included to it's 'src' path. Back then I was a newbie and slowly I started developing my own library which could handle every day simple Android development tasks very easily. Obviously I included the 'Universal Image Downloader' to this.
After dusting off the old project today the first thing I did was to reference my library to speed up the development process but as I was trying to debug I ran into the "Conversion to Dalvik format failed with error 1" over and over again. First I thought it was the support library but even after clearing all libraries and adding only mine and doing a quick 'Fix project properties' I still got it. After trying various solutions I noticed this in the console "java.lang.IllegalArgumentException: already added: Lcom/nostra13/universalimageloader/cache/disc/BaseDiscCache;"
It was as simple as that... I'm trying to compile a class which has already been compiled.
Solution : I just simply removed all the class files I got from 'Universal Image Downloader' library from the 'src' directory. Since my library references "Universal Image Downloader" library the old project started working just fine.
Hit same problem shown on your log when trying to run an example project which was imported into eclipse.
Additional Info: in eclipse's Problems View I see the following error:
"The project cannot be built until build path errors are resolved"
In my case the imported project find the libraries just right(by just right I mean I can see the external path to each of the android libs in this case 2 libs, android.jar and maps.jar). So no shuffling of libs in my case, but might be your problem.
I followed Spock's suggestion of cleaning the project which I had to clean multiple times until it somehow resolve its issues. After, issue was solved I had to specify an AVD for the project to run and soon after was up and running on the emulator. Also, note that my eclipse is set up to Build Automatically.
In my case I'm not missing any class files or anything after the clean as the build is properly generating them.
Regards!
I was getting the same error. My problem was that i had an android device hooked up to debug with. As soon as I unplugged it I was able to export.
The answer I found was checking the source and library build path in the project's properties. Most likely there will be a duplicate as in something being referenced in both the source and library tabs. So delete the extra in the source tab and then clean the project and you should be good to go.
Either:
javax.net.SocketLibrary is in your source code, or
javax.net.SocketLibrary is included in a JAR file in your project
Under certain conditions it gets its knickers in a twist and the best fix I've found is to remove referenced jars, clean, add them back in and then compile again.
I believe the error can be caused by including the same classes twice.
This error will also occur (and you won't be able to get rid of it by cleaning) when using classes that are not part of the Android environment.
To summarise the information in the link bimbim.in provided (well my understanding when I glanced over it)
The Android Davik VM tries to compile the jars but finds some stuff that it can't compile to .dex files
so
Just create a "lib" directory in the root of the project (where the src, bin res directories are) and add them to the build path. Project Properties... Java Build Path... Libraries.. Add JARs..
I could resolve this issue by creating a new project, looks like the some project settings were creating this issue and could not really find the root cause for that. But, dumping the existing source code onto the new project resovled this issue. If anyone has found the root cause for this problem pls do let me know.
I had the same problem and solved it as follows:
- Go to Project/Properties/Java Build Path/Libraries and remove all JARs except Android
- Do a project clean
- Add the JARs again as External JARs (first time I added them internally, so that might be the problem)
After that the error was gone.
I solved the problem by updating available packages in the Android SDK et AVD manager. No need to remove Eclipse.
Whenever the Project is having the ambitious data. This problem is caused. May be android can't able to find which one choose.
From what I understand, this same cryptic error could be caused from a wide variety of reasons. I've got "Conversion to Dalvik format failed with error 1" error too. In my case the problem was that for some reason Project -> Properties -> Java Compiler was not set to "Enable project specific settings" with proper Java 1.5 settings, but was left to defaults instead (1.6 in my case). Debug, build and test on devices/emulators worked fine, but export always failed with the above error message.
If unsure about the proper settings, create the same project on some alternative location and just copy all needed files from the old project into the new one. This fixed the issue for me.
The next problem with the same error message came from using proguard. Updating to the latest version by replacing the one that came with android sdk, fixed that.
Hope this helps
My problem was having a jar file in my src folder. Removing jars from the build path works, but only if you don't need the jar in question. For people who need the jar in question, make sure that your jar file is not in the project folder (maybe just src subtree, but I would keep it separate to test). Put it on your desktop or something and try the "Add external jar.." option. Be sure to remove the jar from the project filesystem before adding another external. Having both is what causes the problem.
I have done it as the instruction of the first answer and it works.(Linux)
I think the problem may caused by SDK or ADT updates.
I do have to clear all the lib in Java Building path and then use android tools to fix the project. After cleaning and rebuild, it works as before.

How to build Android NDK sample: "bitmap-plasma"

I am trying to build the bitmap-plasma sample that is included with the ndk, but getting an error. I run ndk-build from the samples/bitmap-plasma directory, and the error it displays is that it cannnot locate android/bitmap.h file.
How do i direct the ndk-build script to the file it needs?
Using android-ndk-r4 on Ubuntu Lucid 10.04
Well it's working now, so in case anyone was having my same problem:
There as an android-ndk-r4b bugfix release today, which it seems no longer has this problem.
Available to download here.
http://developer.android.com/sdk/ndk/index.html
With Ubuntu 10.04 and NDK r5b, I have just posted a bug report (with the fix included) for build_platforms.sh. See http://code.google.com/p/android/issues/detail?id=15180 for details. Essentially, the local declarations in the symlink routine must be amended. Otherwise, it only links the first file (alphabetically) from each directory, and truncates the remainder from the list.
Correcting this allowed the symbolic links to be fully populated, thereby filling in the missing header files and libraries and allowing the samples to build successfully.

"Resource not found" when building Android app under IntelliJ 9.0 Maia Public Beta

I'm trying to port an app from Eclipse to IntelliJ. The app builds fine but it fails to run properly.
Here's a partial stack trace I receive:
ERROR/AndroidRuntime(957):
java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" ClassLoader: dalvik.system.PathClassLoader#43761190
at org.joda.time.tz.ZoneInfoProvider.openResource(ZoneInfoProvider.java:209)
at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:123)
at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:82)
at org.joda.time.DateTimeZone.getDefaultProvider(DateTimeZone.java:439)
at org.joda.time.DateTimeZone.setProvider0(DateTimeZone.java:393)
at org.joda.time.DateTimeZone.<clinit>(DateTimeZone.java:114)
at org.joda.time.chrono.GregorianChronology.<clinit>(GregorianChronology.java:71)
at org.joda.time.chrono.ISOChronology.<clinit>(ISOChronology.java:66)
at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:97)
at org.joda.time.DateTime.<init>(DateTime.java:120)
For some reason, the app isn't able to find the joda-time resources, even though they're specified in the module's build path. These are the same jarfiles used by the eclipse version of the app.
alt text http://img.skitch.com/20091106-pgqujbb5eaeqc2wfiqc2c1p39a.png
The APK built by the IntelliJ tool is about 20% smaller than the one built by Eclipse, but I don't know why.
Any idea what might be the problem?
UPDATE:
I spoke with romain and xav yesterday, and it appears that the problem is that intellij is not bundling resources into the apk. Evidently aapt does a two pass approach - first it bundles all the class files into a .dex file, and then it bundles all of the resource files separately into the top level of the apk file. It's this second pass that intellij seems to be missing.
As a workaround, they suggested that I unjar all the resource files from the joda-time jar, and place them in my src directory. The expectation was that intellij would then bundle them into my apk as though they were part of my own source, thus solving the problem. However, when I did this, IntelliJ ignored those files entirely when it created the apk.
I don't know why. Is there maybe a workaround I can use to get the joda-time resource files into my apk that isn't terribly inconvenient every time I want to build?
This is a pretty old version of intellij at this point. 10.5 seems to resolve all of my issues with android dev
Isn't your problem the scope of your dependencies ? If they're only used to compile, it's not garanteed to work at Runtime is it ?
I'm not a user of IJ myself but from your screenshot that's my guess. It would also explain why the size of your android package is 80% lower.

Categories

Resources