How to configure mopub ads?

9

When you install the mopub plugin in Android Studio you choose the type banner ad and it gives you all code so you can paste it in the right place.

You run it works right appears on the test ad, there you go to the site and create the key catch and exchange that is in the program, then tested on the physical phone and advertisement does not appear, have more configuration to do? >

The error appeared in XML:

  

Rendering Problems The following classes could not be instantiated:   - com.mopub.mobileads.MoPubView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode () in your custom views to skip code   or show sample data when displayed in the IDE Exception Details   java.lang.NullPointerException at   android.webkit.WebViewFactory.getWebViewPackageName (WebViewFactory.java:78)   at   android.webkit.WebViewFactory.getFactoryClass (WebViewFactory.java:132)   at   android.webkit.WebViewFactory.getProvider (WebViewFactory.java:101)   at   android.webkit.WebViewDatabase.getInstance (WebViewDatabase.java:44)   at com.mopub.mobileads.MoPubView. (MoPubView.java:77) at   java.lang.reflect.Constructor.newInstance (Constructor.java:422) at   android.view.LayoutInflater.rInflate_Original (LayoutInflater.java:806)   at   android.view.LayoutInflater_Delegate.rInflate (LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate (LayoutInflater.java:782)   at   android.view.LayoutInflater.rInflate_Original (LayoutInflater.java:809)   at   android.view.LayoutInflater_Delegate.rInflate (LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate (LayoutInflater.java:782)   at android.view.LayoutInflater.inflate (LayoutInflater.java:504) at   android.view.LayoutInflater.inflate (LayoutInflater.java:385) Copy   stack to clipboard

logcat on mopub:

  

06-19 14: 31: 10,973 2319-2319 / PeckageName. D / MoPub: Failed to   retrieve GPS location: access appears to be disabled. 06-19   14: 31: 10.983 2319-2319 / PeckageName. D / MoPub: Failed to retrieve   network location: access appears to be disabled. 06-19 14: 31: 11,023
  2319-2319 / PeckageName. D / MoPub: Loading url:    link My.Key & nv = 3.8.0% 2bkit & dn = unknown% 2Csdk% 2Csdk & bundle = PeckageName. & z = -0400 & = = & h = 800 & sc_a = 1.5 & mcc = 310 & mnc = 260 & cn = Android & ct = 3 & av = 1.1 & dd = mp_tmpl_advertising_id & dnt = mp_tmpl_do_not_track & mr = 1 & android_perms_ext_storage = 0   06-19 14: 31: 14.583 2319-2390 / PeckageName. D / MoPub: Failed to   retrieve GPS location: access appears to be disabled. 06-19   14: 31: 14.583 2319-2390 / PeckageName. D / MoPub: Failed to retrieve   network location: access appears to be disabled. 06-19 14: 31: 14,653
  2319-2319 / Peckage.lamathName I / MoPub: Ad failed to load. 06-19   14: 31: 14.653 2319-2319 / PeckageName. I / com.mopub: Ad failed to   load.

With test key works.

Thishassomethingtodo,onthesiteitseemsliketotest,seetheimagebelow.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="NomeDaPeckage"
    android:versionCode="1"
    android:versionName="1" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="NomeDaPeckage.Activity"
            android:configChanges="orientation"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value=" " />
        <activity
            android:name="com.mopub.mobileads.MoPubActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name="com.mopub.mobileads.MraidActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name="com.mopub.common.MoPubBrowser"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
    
asked by anonymous 18.06.2015 / 22:22

1 answer

3

While reading these messages

06-19 14:31:10.973    2319-2319/NomeDaPeckage. D/MoPub﹕ Failed to retrieve GPS location: access appears to be disabled.
06-19 14:31:10.983    2319-2319/NomeDaPeckage. D/MoPub﹕ Failed to retrieve network location: access appears to be disabled.

What makes me believe you did not release the GPS and NETWORK for your application, you would need this:

  • Declare the following permissions:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
  • Declare the following "activity":

    <activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    <activity android:name="com.millennialmedia.android.MMActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />
    <activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />
    

I think android.permission.ACCESS_COARSE_LOCATION already solves the GPS issue, but if you still report the error access appears to be disabled. , then try the following permission:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">
  • ACCESS_COARSE_LOCATION is based on internet network
  • ACCESS_FINE_LOCATION is based on GPS

Details on: link

    
24.06.2015 / 23:28