Unity Android Debugging Tips - android

Today I finally managed to build my first android application in Unity. It works nice in the editor but it doesn't work on some real android devices so I used adb logcat to try to find the root of the problem. Here is the log: http://pastebin.com/uHAE3BTb.
I'm rather noobish in Unity, don't really know android java specific functions, I'm quite fond of debugging and I don't know where to start so I need your help for this one.
How do I find where my app fails from adb logcat? Is it possible or should I start commenting lines of code, rebuild and see if it fails every time? Is there another way of doing this?

You just have to be smart about reading the logs. This (I'm sure you know this already though) is the problem:
E/AndroidRuntime( 4994): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Vali.Atomic/com.unity3d.player.UnityPlayerNativeActivity}: java.lang.IllegalArgumentException: Unable to find native library: main
Looks to me like Unity is not building it's jar file correctly for you. Ensure the android sdk is installed correctly and properly setup within Unity. Also, ensure that the 32 bit version of JDK is also installed and is being used by Unity when compiling

Related

unity freeze and crash when change scene. Any idea?

When I try to change the scene it freezes, then crashes. But after a while I tried again to open the app, and it worked. Any idea why?
I've already unchecked split application binary. I also tried to open an empty scene and it worked perfectly fine. Could it have anything to do with my object in the scene?
This happens only on Android, it worked well in unity editor.
There can be many reasons. Without code or project settings we can only guess what caused crash. When debugging on Android, it is good to use logcat from which you can read what caused the crash.
How to add logcat to project:
In Unity editor: Window - Package Manager - Android Logcat - Install
Build and run your project
You will find what caused the crash in logs
This way you can identify most errors and not just this specific one.

Lime 5.2.1 / Android 4.3 : dlopen fails on stpcpy

I'm trying to build an empty HaxePunk project for Android to test the build chain, and while I'm never getting any error, all my attemps have crashed at run time with the same error message :
Error: dlopen failed: cannot locate symbol "stpcpy" referenced by libzlib.so...
I am running the executable on a pretty old phone with Android 4.3 on it ; a Sony Xperia M.
I have been doing a bit of research, and so far I mostly see the same things being repeated : update your NDK (I've been using the latest one from the android dev website and not the one lime setup android downloads), build for previous API versions (which I am also doing with <config:android target-sdk-version="18" /> in my project.xml file). So I don't know what I'm doing wrong, if anything.
Another thing I found is that I'm using the git version of HXCPP, and when I built the Android libs with neko build.n android in the project subdir, it was using -DHXCPP_ANDROID_PLATFORM=26 whereas the Lime build of my project is using -DHXCPP_ANDROID_PLATFORM=9, so that can't be good. However, I don't really know much about Android at all, but I have read that the SDK version and Android platform are two different things, or so I've read.
Any help with this will be much appreciated.
EDIT : Okay so something weird happened : up until now I was trying to install the APK manually by copying it to my phone's files and launching it from there, which kept crashing. I tried lime test android once without changing anything at all and it worked fine, and from then I could manually install the APK like I used to, and the error never happened again. I can't replicate it, but it's still an open case.

Error while running app in android emulator

So I have just started my first app in which I have a button and when user clicks on it then it just print the message.
But when I build the app and when I run that app on android studio's console then after opening it crashes and then it stops working.
Meanwhile I have searched for the error and they suggested me to see logcat table or the text file in which I can easily see the errors but after it I am stuck because I have no idea that how can I solve such problem.
Please help me with it.
Not sure how capable you are with android and you haven't given us much info to work with.
could you post a brief description of the logcat from launching the apk to the apk actually crashing?
the logcat is gonna be the best option to diagnose it.
Are you using the android sdk and emulator?
Have you updated the resources and api's?
If you go into the resource list there should a online repo with a whole lot more SDK bits you might find help.
What api's and android version is your apk built from and is your emulator emulating the same android build?
Could be the apks GUI resolution or script related, have you checked through it all?
Microsoft visual studios has a very good debug system and trouble shoot but I'm not sure if android is compatible as I've only used wp8 on it. Worth finding out though.

Android eclipse run program causes Installation error: 0

I have an Android application. In the latest version I've moved some code from it into separate Android Library projects (two). One library depends on another and project depends on both libraries. So, as I understand, one library includes into final application "twice" (or something similar to twice).
On the first launch of application I receive following in Console (I am using Eclipse):
Installation error: 0
Please check logcat output for more details.
Launch canceled!
Can anybody help?
Thanks!
EDIT
On the second launch program starts normally.
EDIT
I tried to reproduce error on the emulator and other device, it didn't reproduce! Can a problem be on my device? May be on file not deleted or something else?
I've reinstalled Android on my phone and problem solved :) Not a good solution, but works.

Application crashes in emulator when loading native shared library, but works fine on a physical device

The header pretty much explains the issue. I'm getting "Unsatisfied link error" on emulator. What could be the cause and what are the possible solutions?
Some time ago, when we started developing the app, it did work fine on emulator, and one day just stopped. It happened on at least two independent machines.
Ideas, anyone?..
Update: created a new emulator - same thing.
Problem solved! it appears, Android QUEMU emulator only supports ARM5 (APP_ABI:=armeabi), and my library was compiled with armeabi-v7a.
Update: the problem no longer exists.
You should check the following :
Using adb shell go in to the sys/lib/ folder and check if your library was copied there
Did you change the package of your class or did some refactoring? If you did and didn't updated the .cpp file this is causing the unsatisfied link error.
You can also try to manually load your library using System.loadLibrary("myLib");
You could also try to create a new emulator, maybe it got messed some how. Happens a lot.

Categories

Resources