So, let's just give the free projects a separate, Identical layout. It's seems to be the only way to go. I hate to do it, I really do. But, all the code is in place, and I want to move on to the IOS version.
Here's the relevant layout code:
<com.mobfox.sdk.MobFoxView android:id="@+id/mobFoxView"
android:layout_width="fill_parent" android:layout_height="50dp"
publisherId="1c8b07052f7c4e4a7aafb10f515cd6dc"
mode="live"
includeLocation="true"
animation="true"/>
The id will differ from page to page, but that's it. Add the source lib and drag int the mobfox sdk, and give it a try. Let's try it first in level 5. Hmmm - no luck.
E/AndroidRuntime( 1001): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kanjisoft.jlpt5.free/com.kanjisoft.jlpt5.free.BootStrapActivity}: android.view.InflateException: Binary XML file line #115: Error inflating class com.mobfox.sdk.MobFoxView
E/AndroidRuntime( 1001): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1001): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1001): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1001): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1001): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1001): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1001): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 1001): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1001): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1001): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 1001): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 1001): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1001): Caused by: android.view.InflateException: Binary XML file line #115: Error inflating class com.mobfox.sdk.MobFoxView
/AndroidRuntime( 1001): Caused by: java.lang.ClassNotFoundException: com.mobfox.sdk.MobFoxView in loader dalvik.system.PathClassLoader[/mnt/asec/com.kanjisoft.jlpt5.free-1/pkg.apk]
E/AndroidRuntime( 1001): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E/AndroidRuntime( 1001): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
E/AndroidRuntime( 1001): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 1001): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
E/AndroidRuntime( 1001): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
E/AndroidRuntime( 1001): ... 20 more
W/ActivityManager( 101): Force finishing activity com.kanjisoft.jlpt5.free/.BootStrapActivity
It's barfing on the MobFox class, presumably because it's not available to the core library. Ok - I know I've tried this before, but let's add the modfox jar as a source lib to the core project.
And it's exactly the same result. Ah, there it is, in the Mobox instructions (which for some reason are uncopyable)
"Also add the ModFoxLibrary to your Java Build Path".
Good. I'm not convinced that I had them both in there simultaneously.
Let's just add it to both projects to be sure. I wonder if I should use Android, add lib? It doesn't say to.
When I add the MovFox jar to the dependent project, it won't compile, although it won't say where the problem is. Let's remove it.
It's freezing here in Panera - I forgot my sweatshirt.
Ok, it's not crashing, but the ad isn't showing, event when I switch it to test. Let's put the mobfox view into the core layout.
It must be like, 55 degrees in here.
Nope, still not showing. Let's delete the start layout from the shell project.
Still no ads showing - just blank, although I set it to test. I did have the ads showing at one point, really.
Ok - when I clean everything, I get this familiar error:
E/AndroidRuntime( 1890): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kanjisoft.jlpt5.free/com.kanjisoft.jlpt5.free.BootStrapActivity}: android.view.InflateException: Binary XML file line #114: Error inflating class com.mobfox.sdk.MobFoxView
E/AndroidRuntime( 1890): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1890): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1890):
E/AndroidRuntime( 1890): Caused by: java.lang.ClassNotFoundException: com.mobfox.sdk.MobFoxView in loader dalvik.system.PathClassLoader[/mnt/asec/com.kanjisoft.jlpt5.free-1/pkg.apk]
E/AndroidRuntime( 1890): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E
So, what we can be sure if is the shell project needs to see this class file. Let's try adding as a jar file (which was what caused all the problems before, once it was uploaded. Call me a glutton for punishment. I just want to be sure).
Let's remove it as a jar from the core, and clean all before running. It really looks like this MobFox was a bad idea. Their tech support hasn't responded to two emails.from me. This shouldn't be this hard to do.
I had to clean the core project twice to get rid of the R error. Man, it's cold in here.
Well, the core project has the red exclamation point. I'm pretty sure we need to re-add the jar.
I'm clearly in a rathole, as I was the other night on this same code. In that case, it was working until I uploaded it to the App marketplace, in which case it just did strange things like pulling the wrong elements out of the R file. In this case, it's just not showing up the ads - even when it's in test mode. Bummer.
Usually what I do when I get to this point is just try to get a very simple thing to work. For example, just show the MobFox in a trivial project, to prove it works again.
There is one lead I haven't followed. This nasty, suspicious error keeps showing up in my console:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/mobfox/R$attr;
[2011-08-20 17:22:37 - JlptQuiz5Full] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2011-08-20 17:22:37 - JlptQuiz5Full] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2011-08-20 17:22:37 - JlptQuiz5Full] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[bunch of messages]
[2011-08-20 17:22:37 - JlptQuiz5Full] Dx 1 error; aborting
[2011-08-20 17:22:37 - JlptQuiz5Full] Conversion to Dalvik format failed with error 1
It's not liking mobfox's R file - because it's already in the core project? But we know we get a class not found exception if we don't include the jar file.
Here's something in StackOverflow:
http://stackoverflow.com/questions/2759793/android-getting-error-conversion-to-dalvik-format-failed
They are essentially saying, it's a duplicate class. Which we already know. The problem is the outer project for some reason needs access to the the modfox class. Why? Because it's accessing start_layout.xml. Why does it do that? For the splash screen effect. What if we found a different way to get a splash effect? Hmm.
Let's get rid of the access the start_layout and of the jar file in the shell project to eliminate this error.
Ok, that's not going to work. The outside class definitely needs access to the core class files - the manifest declaration of activities is proof.
It's beginning to look like my exalted library structure can't accomodate ads.
Wait. Didn't I try setting it up as a separate library project before? Wait, if It's a library project, shouldn't everything needed be pulled in with the inclusion in core in the library project? I shouldn't need the two duplicate jar files.
My course of action is clear. I'm just going to have to do thing this as a single project. I actually prefer it that way. It's two products instead of 10. I'll get read of all these shell projects. All I need to do is a modification to accommodate multiple levels. Illl do that on my next post. The two projects will have all the logic combined in them. There won't be shell projects.
No comments:
Post a Comment