I am using MobFox with Android. I have a MobFoxView in one of my layouts. Runs fine when I compile the Android for 4.0.3. However, I wanted to try and build it for 2.0.1, and now it won’t work.
On the visual editor I get the following error:
The following classes could not be instantiated:
- (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
In the error log I see:
com.mobfox.sdk.MobFoxView failed to instantiate.
java.lang.NullPointerException
at com.mobfox.sdk.MobFoxView.<init>(MobFoxView.java:189)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
My MobFox view code is:
<com.mobfox.sdk.MobFoxView
android:id="@+id/mobFoxView"
android:layout_width="fill_parent"
android:layout_height="50dp"
mode="live"
publisherId="..." />
I’m importing the MobFox library through the .jar file. Runs fine when compiling for Android 4.0.3.
Thank you in advance
Turned out be something completely unrelated: In the layout, I had two attributes in “match_parent”, which is supported in Android 4 but not 2. Changing them to “fill_parent” allowed the files in the gen folder to be normally generated again and everything working.
Not a MobFox problem after all.