1

在我的 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"/> 怎么做才能成功实施横幅?提前致谢

4

0 回答 0