Friday, 20 April 2012

Android: NoClassDefFoundError

My Android Eclipse project uses two external jars: Flurry and Admob. They work fine until I upgraded Android SDK to 4.0.3. Then there is forced close due to java.lang.NoClassDefFoundError: com.flurry.android.FlurryAgent.


The fix is to check these two jars in the "Order and Export" tab.

Saturday, 14 April 2012

Android: proguard cannot find symbols in Flurry

When exporting signed signed application package in Eclipse, proguard emits warnings about not being able to find Flurry symbols, then aborts.

The fix is to add


-libraryjars /path/to/FlurryAgent.jar

to proguard.cfg

Friday, 13 April 2012

Unity: How to test iOS Unity Apps without using Xcode

Xcode is slow when building Unity iOS apps. It is not a good option for testing Unity iOS apps since it could take several minutes to build the app.

You cannot use the Game panel in Unity to test iOS apps which handles touch events because the Game panel does not emulate touch event with mouse. If you use the Game panel, Input.TouchCount is always zero since there is no touch events.

You need to use Unity Remote to test Unity iOS apps. It is a iOS app which can be downloaded from Apple App Store freely and installed on your iOS devices. Before testing your app, connect your iOS device to your Mac, then run Unity Remote on your iOS device and select your Mac machine. In Unity, run your app, the Game panel will stream video display to Unity Remote and Unity Remote will pass touch events from your iOS device to the Game panel. This way you can test your Unity iOS app with all the iOS events.

Wednesday, 11 April 2012

Unity: Problem with invalid signature on iOS

If you build Unity project for iOS and see this error when running the app:

The application does not have a valid signature


And your development provisional profile are OK. It can be caused by having more than one development provisional profiles. You can use organizer to remove extra development provisional profiles and only keep the generic one. This should fix the problem.

Unity: problem with Xcode 4.3.2

Currently Unity basic edition does not work with Xcode 4.3.1 and 4.3.2. The error is:

You are using Unity iPhone Basic. You are not allowed to remove the Unity splash screen from your game


The workaround is generate your Xcode project and build it with Xcode 4.3 or older version.


Until now there is no fix yet. Unity is aware of this issue and promised a fix in the next release.


http://forum.unity3d.com/threads/126820-Unity-3.5-and-iOS-5.1

Saturday, 7 April 2012

Android: cannot use Admob due to String types not allowed at 'configChanges'

I was trying to use Admob in my app and added this to my AndroidManifest.xml:


<activity

android:name="com.google.ads.AdActivity"    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>

then there is a build error:

Sting types not allowed at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize'.

Turns out to use Admob you need to change build target to be at least 13. You can still let your app run on lower Android versions even your build target is 13. build target is only for build. Your minimum required OS version is specified by uses-sdk minSdkVersion.

http://stackoverflow.com/questions/7902121/admob-cant-display-ads-because-of-configchanges



Android: Project build target vs minSdkVersion

Project build target is the SDK version you build your app with. minSdkVersion is the minimum SDK version you want your app to run on.

You want to build your app with latest SDK since it may contain bug fixes not available in older SDK, but you can still run your app on an older SDK. For example, you can set project build target to be 15 (Android 4.0) but set minSdkVersion to be 8 (Android 2.2).

You set project build target by right click your project and choose "properties", then go to "Android" and select "Project build target".

You set minSdkVersion by setting  <uses-sdk android:minSdkVersion="x" />  in AndroidManifest.xml, before application node.

Android: Eclipse no output in LogCat

For unknown reason my eclipse has no output in LogCat. This is very bad since the output at exception goes to LogCat, without which it is impossible to know what is wrong when app is forced to close.

Luckily found a solution on Stackoverflow: switch to DDMS perspective and click the device running the app, then switch back to Java perspective.

http://stackoverflow.com/questions/2250112/why-doesnt-logcat-show-anything-in-my-android