在我的xml中,我编写了这段代码,并且我使用了发布商ID测试:
<LinearLayout
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/b1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/ic_launcher10" />
<com.adsdk.sdk.banner.AdView
android:id="@+id/mobFoxView"
android:layout_width="300dp"
android:background="#000000"
android:layout_height="50dp"
request_url="http://my.mobfox.com/request.php"
publisherId="fe96717d9875b9da4339ea5367eff1ec"
location="true"
animation="true"
/>
</LinearLayout>
但与此同时我收到了这条消息:
The following classes could not be instantiated:
- com.adsdk.sdk.banner.AdView (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
java.lang.NullPointerException
at com.adsdk.sdk.banner.AdView.<init>(AdView.java:95)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( 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)
当我启动应用程序时它会崩溃。 我在库中添加了AdSdk_4.1.6.jar和mobfoxsdk-1.5.jar。 我已添加清单此权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
并且:<activity android:name="com.mobfox.sdk.InAppWebView"/>
如何成功实施横幅广告?提前谢谢