I've been recently trying to make some very simple app in Qt, and yesterday it used to work correctly on both Desktop and Android (using android ndk, I know it's not good to make android apps in c++, but I just want to try).
Today, out of nowhere, application output says sth like this:
The only thing I've found was cleaning app's cache and data, restarting phone, rebuilding, none of these things worked
A Qt app has an array of used .so library names, somewhere in the resources.
On start-up, it loads all these .so libraries (via loadLibrary()).
The order in which the libraries are loaded is important: functions cannot
reference functions defined in libraries that have not yet been loaded. So implementing a circular dependency is tricky.
From the logs I see that
some function in libszachy_android_1.so (is it the right name? it's a bit strange) invokes srand() that has not yet been loaded; maybe, it is mentioned later in the load list, but loadLibrary() has no idea about the planned future.
Therefore, you get this.
If your code worked yesterday, you likely have made some changes. If you use version control, you likely can compare the today's and yesterday's versions and see the difference. Maybe, you have inserted a forward reference (in the load list sense). OTOH, sometimes both Eclipse and make cannot detect that the source has changed and make incorrect builds (I did observe this, but cannot reproduce). Did you try to uninstall the app from the phone? Did you try to remove all existing .so files in the build directories (rm *.so)?
Maybe, one of your .so modules is broken: sometimes an object is generated despite of errors and it may get used in subsequent builds (at least this is how I can explain the build glitches).
Maybe, you have no memory left on the device, and the .so could not be unpacked correctly.
I suggest examining the application directory with adb shell on a rooted device.
PS you posted a screenshot that is barely readable. Please replace it with the relevant portion of the adb logcat output (I hope you know how to use it; if not, the first thing to do is to learn adb logcat and adb shell).
Related
Not a single one of my references is working including 'system' and 'micrsosoft'. I am trying to make an android app using monogame through visual studio 2019 and I've tried repairing and reinstalling visual studio 2019 and neither has worked. My project name does have a space in it and I've attempted to change that to no success (perhaps I wasn't trying correctly). It was completely fine yesterday (08/01/2022, dd/mm/yy) and I do not believe I have done anything to cause this to happen. I am using C# if that helps.
I have had this problem before, and I was very confused as well. I believe that the solution involves checking the packages installed for that project and making sure that the correct ones are installed. If the packages are outdated in comparison with the project, there seems to be incorrect ones installed which override and mess up the default reading of the system and Microsoft namespaces, making them unrecognizable. Make sure that you have the latest version of MonoGame, and that you make a project through one of those newest templates, which should set everything up properly. I have worked with MonoGame, and I remember this happening a couple of times. Like I said, just make sure everything is up-to-date, and that the project is made with those up-to-date tools. Lastly like you said, avoid anything that could cause further problems such as spaces between any of the platform projects, etc.
The messages you are seeing are coming from an incomplete Intellisense loading.
This condition should not effect the compilation or running of the game. If the game does not run; There is something wrong in the framework or configuration files (Jump down to suggestions.)
The loading of SDK style projects, like MonoGame 3.8, is more intensive than the older .SLN files. Each of the NuGet packages is checked for updates, then loaded. Only after all of the packages are updated, downloaded and loaded, does Intellisense start to load rules beyond the base C#.
Any sort of hold-up, like network delays, or issues such as low memory, slow hard-drive access or high processor utilization, can cause delays or timeouts in the Intellisense loading process.
To make things worse, the partially loaded Intellisense is taking up many of those same starved resources parsing and accumulating non-existent errors in any open tabs.
Solutions:
Make sure you have enough RAM. On my system VS2019 takes around 3GB + the game. Anything less than 8 GB is a non-starter.
Do not have anything else open when loading VS2019. Wait for it to finish loading before opening the project. VS restores the open tabs in a project, close them all, and wait until it is settled (there are tasks in the background so wait a few minutes), then restart VS.
Some virus scanners have been known to use large amounts of resources...(I am not going there, too many risks) ...
Or use a lighter editor like VS Code.
Suggestions:
Develop and test as much of your game as possible using the Windows DX profile, since iteration times are exponentially faster. Then, when the logic is complete, create a new Android project and copy Game1.cs and all created files to the new project, changing the namespace in Activity1.cs (Android's equivalent to Program.cs) to match.
Background
I wanted to simplify the usage of DB in an Android app.
For this, I've compared some third party libraries that create a DAO layer.
I've come up with a nice library called "GreenDao" (presentation about it here) . The website shows that it's faster than other competitors (like ORMLite) and is optimized for Android.
The problem
For some reason, on some device (usually old devices, with GB) , I get the next console error when trying to install the app:
Installation error: INSTALL_FAILED_DEXOPT
Please check logcat output for more details.
Launch canceled!
I've searched for the reason of this error, but couldn't find out how to solve it. Many complain about this error, but I can't find out why it occurs, and what can be done.
The error is quite common and known, but it's never mentioned as the result of using this library, yet when I remove the usage of this library, everything works fine...
Also note that on newer devices (like nexus 4) it installs and works just fine, and that the sample itself also works fine no matter which device I test it on.
The question
Why does it occur?
Is it possible that the structure of the classes is just too much for old devices to load, since we use other libraries ?
Could it be that I've reached the limit of code that is supported by android apps?
The jar file itself takes just 87KB ...
How can I solve this?
Ok, I've found the problem and the solution:
It has nothing to do with GreenDao.
It's because the app uses too many jars, so maybe Android has a limitation of code.
The solution is to either delete un-needed jar files or delete a lot of code.
Here's an odd issue I can't seem to find any information on.
I'm working on an Android app with a friend who uses Eclipse -- I use Ant and the Android command-line tools. Sometimes when I checkout code that was written by him and the project.properties file gets pulled into my local workspace, I'll have to change the path to the libraries back to where they're at on my machine, as it gets automatically set for him via Eclipse. This may be of use to know in light of what just started happening when I try to launch 'monitor' as I've always done; I get this error dialog box that pops up and says: An error has occurred, please see the logfile: /home/user/.android/monitor-workspace/.metadata/.log
So I did. It was, after I'd tried to launch monitor several times to no avail, a really long logcat-like file of Java traces. I cleared them out, thinking that perhaps it had run over its own max size for internal monitor data, but that didn't stop it crashing. A new set of errors just gets appended.
This is the first time this has ever happened, and unlike essentially every other Android problem I've had, I can't seem to find any existing information on it. The device monitor now seems to want to be integrated into Eclipse. I don't use Eclipse so I'm not sure how the monitor runs within it, or whether I'm correct in assuming that some configuration file somewhere needs to have a line changed (or whatever).
Here's the content of the logfile:
http://pastebin.com/JitCWrGg
Could anyone lend a word of advice?
Many thanks!
I have task to modify android gingerbread launcher (2.3). I want to download launcher's sources and add some functionality. I have found sources here:
android Gingerbread launcher sources
I download this and import into workspace as is. As a result I get numerous compile errors (some classes are missing, instance variables are missing, etc). Why? I mean why wouldn't it compile? What should I do to make it compile?
P.S. By the way, when project is imported, used platform as per project settings is not 2.3, so I have to manually set it to 2.3. However, numerous errors still remain.
To convert an AOSP application into a standalone SDK application, you will need to find all the "classes and variable not present in the SDK" and remove/replace the references to them. The simplest is to remove the references to them, if the app will still run with reduced functionality. For references to internal resources, you can simply copy those to your project and modify the R values to point to your local copy. You are welcome to examine the "classes and variable not present in the SDK" and determine that you can copy those as well (refactoring them into a new package), in which case you would update your project to refer to the copied and refactored classes.
The easier solution would be to use someone's source where they already did that..Here found one at
Launcher2 full compilable Ginngerbread lancher code
Have a look at here.
It is the Launcher2 from ICS, not GB, but they are very similar.
From Wiki: Note that it is not completely bug free, and adding widgets will crash the app (as it uses a system level permission. Maybe if you installed via root it'll work).
Here's a list of what all I had to do, that I can recall doing:
There are lots of methods like setFastXXX (for example, setFastAlpha()) that aren't available to us. Changing these to setXXX (for example, 'setAlpha()`) worked for me.
Some thing which are available to us via getSystemService() are initialized directly in the code, like the usage of the Vibrator class. These need to be changed to use getSystemService().
I am trying to restructure an existing app so that, except for a few override-able methods in a derived activity, all code will reside in a library. This still doesn't work for some reason, but in the process of attempting to troubleshoot this, I discovered much to my dismay that there are two .apk files installed, not one (when I run a debug session from eclipse):
The first (and larger file) is
having the original library name.
The second (only 20KB in size) is
having the derived application name.
Why is that and where can I learn more about this?
Could that explain the ClassNotFoundException problem I am having?
I found the answer myself. It turns out that I had 2 critical settings in the Properties of both projects not set correctly:
In the library project, "Is Library"
was not checked for some reason. I
could swear that I checked it, but
knowing how whimsical the Android
development environment under
Eclipse can be, I suspect that it
was unchecked by Eclipse (or the ADT
plugin) as a result of some glitch.
In the application project, I
neglected to add my library project
as a reference via the Add...
button. (how dumb could I be?)
Hoping this can be useful for other newbies to come.