我正在尝试在Android应用程序中显示OpenX广告。我已安装SDK并按照找到的视频here进行操作。一切顺利,除非我编辑布局。我经常在错误日志中遇到这个友好的错误消息。
eclipse.buildId=M20120914-1800
java.version=1.7.0_11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86_64
Error
Thu Mar 14 17:40:44 PDT 2013
com.openx.ad.mobile.sdk.views.OXMAdBanner failed to instantiate.
java.lang.NullPointerException
at com.openx.ad.mobile.sdk.controllers.OXMAdBaseController.<init>(OXMAdBaseController.java:130)
at com.openx.ad.mobile.sdk.controllers.OXMAdController.<init>(OXMAdController.java:37)
at com.openx.ad.mobile.sdk.views.OXMAdBanner.init(OXMAdBanner.java:141)
at com.openx.ad.mobile.sdk.views.OXMAdBanner.reflectAttrs(OXMAdBanner.java:136)
at com.openx.ad.mobile.sdk.views.OXMAdBanner.<init>(OXMAdBanner.java:86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:749)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:385)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1059)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:686)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:292)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3023)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1730)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:270)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
我在Google上找不到任何帮助,我想知道是否有人之前有过这个问题。我正确设置了清单,并运行了android:targetSdkVersion =“17”
<activity
android:name="com.openx.ad.mobile.sdk.OXMAdBrowser"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
因此,由于没有构建错误,我可以启动我的应用程序,但它很快就会产生错误并引发一些错误。
03-14 17:45:35.517: E/AndroidRuntime(23227): FATAL EXCEPTION: main
03-14 17:45:35.517: E/AndroidRuntime(23227): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.portlandtribune.pamplinmedia_beta/com.portlandtribune.pamplinmedia_beta.PM_section}: android.view.InflateException: Binary XML file line #97: Error inflating class com.openx.ad.mobile.sdk.views.OXMAdBanner
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.os.Looper.loop(Looper.java:137)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-14 17:45:35.517: E/AndroidRuntime(23227): at java.lang.reflect.Method.invokeNative(Native Method)
03-14 17:45:35.517: E/AndroidRuntime(23227): at java.lang.reflect.Method.invoke(Method.java:511)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-14 17:45:35.517: E/AndroidRuntime(23227): at dalvik.system.NativeStart.main(Native Method)
03-14 17:45:35.517: E/AndroidRuntime(23227): Caused by: android.view.InflateException: Binary XML file line #97: Error inflating class com.openx.ad.mobile.sdk.views.OXMAdBanner
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.portlandtribune.pamplinmedia_beta.PM_section.onCreate(PM_section.java:145)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.Activity.performCreate(Activity.java:5008)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-14 17:45:35.517: E/AndroidRuntime(23227): ... 11 more
03-14 17:45:35.517: E/AndroidRuntime(23227): Caused by: java.lang.reflect.InvocationTargetException
03-14 17:45:35.517: E/AndroidRuntime(23227): at java.lang.reflect.Constructor.constructNative(Native Method)
03-14 17:45:35.517: E/AndroidRuntime(23227): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-14 17:45:35.517: E/AndroidRuntime(23227): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-14 17:45:35.517: E/AndroidRuntime(23227): ... 24 more
03-14 17:45:35.517: E/AndroidRuntime(23227): Caused by: java.lang.NullPointerException
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.openx.ad.mobile.sdk.controllers.OXMAdBaseController.<init>(OXMAdBaseController.java:161)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.openx.ad.mobile.sdk.controllers.OXMAdController.<init>(OXMAdController.java:37)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.openx.ad.mobile.sdk.views.OXMAdBanner.init(OXMAdBanner.java:141)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.openx.ad.mobile.sdk.views.OXMAdBanner.reflectAttrs(OXMAdBanner.java:136)
03-14 17:45:35.517: E/AndroidRuntime(23227): at com.openx.ad.mobile.sdk.views.OXMAdBanner.<init>(OXMAdBanner.java:86)
还有其他人有这个问题吗?
其他信息
我正在使用xml布局文件的标准代码。我知道我没有指定任何细节,但它不应该返回com.openx.ad.mobile.sdk.views.OXMAdBanner无法实例化错误。正确?
<com.openx.ad.mobile.sdk.views.OXMAdBanner
android:id="@+id/banner"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_horizontal|center_vertical"
domain="d.example.com"
portrait_id="1234"
landscape_id="4321"
change_interval="30000" />