How to set up mopub ads?

Asked

Viewed 610 times

9

When you install the plugin mopub in the Android Studio you choose the type of banner ad and it gives you all the code to go pasting in the right place.

You perform works right appears in the test ad, then you go on the site and create the banner picks key and exchange that is in the program , ai testei on physical phone and advertising does not appear, has more configuration to do?

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 Shown 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)   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/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. 06-19 14:31:11.023
2319-2319/Namepapeckage. D/Mopub Loading url: http://ads.mopub.com/m/ad?v=6&id=My.Key&nv=3.8.0%2Bkit&Dn=Unknown%2Csdk%2Csdk&Bundle=Peckage name. &z=-0400&o=p&w=480&h=800&sc_a=1.5&mcc=310&mnc=260&iso=us&cn=Android&ct=3&av=1.1&udid=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/Nomedapeckage. D/Mopub Failed to Retrieve GPS Location: access appears to be disabled. 06-19 14:31:14.583 2319-2390/Nomedapeckage. D/Mopub Failed to Retrieve network Location: access appears to be disabled. 06-19 14:31:14.653
2319-2319/Nomedapeckage.lamath I/Mopub Ad failed to load. 06-19 14:31:14.653 2319-2319/Nomedapeckage. I/com.mopub Ad failed to load.

With test key works.

inserir a descrição da imagem aqui

Does this have anything to do, the site seems to test, see the image below.

inserir a descrição da imagem aqui

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>
  • 1

    Hello. Could you please search your logcat for any references with MoPub? Probably, some error is appearing while trying to initialize your ad

  • 1

    If there was an error, it probably appeared on your logcat!

  • 1

    This error is a rendering problem in the preview of your layout. With your device connected, go to the tab Android in the footer of Android Studio, select logcat and, in the search field, type MoPub. See if anything pops up

  • is no longer running, this error appears 06-18 16:10:53.919 13727-13727/system_process E/cutils-trace﹕ Error opening trace file: No such file or directory (2)

  • @sicachester of a look at the question put what appears in the logcat, funny change the key for the test key works .

  • @sicachester I edited the question I added one more thing regarding the site, good requests (orders ) changes the value but the rest is 0 print clickis

  • @sicachester can you help me?

  • you can include your AndroidManifest.xml? I’m suspecting it’s some configuration missing

  • @sicachester already edited the question and AndroidManifest.xml is there

  • Probably some "step" is missing in the configuration of Mopub. Follow these instructions https://github.com/mopub-android-sdk/wiki/Getting-Started

  • @sicachester I’m using android studio, the link you passed does not have for android studio, I’m kind of lost in this setting, because when I implemented I installed the plugin, it will appear there tab, you choose the type of banner or full screen there it already configures, if you just change the androidManifest.xml there are some things that get wrong.

  • who are <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />&#xA; <activity android:name="com.millennialmedia.android.MMActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />&#xA; <activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />

  • and more <meta-data android:name="com.google.android.gms.version"&#xA; android:value="@integer/google_play_services_version" />

  • Try to remove the attribute screenSize of all the Activity from your manifesto and try again

  • didn’t work, mopub needs another linked ad network to work.

  • @Rodolfo would like to know if the answer lacked something or did not work. Could you inform me?

  • I really couldn’t make it work

  • @sicachester could inform me if moPub it is necessary to create an advertising network or it has its own advertisement?

Show 13 more comments

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.

Which makes me believe that you didn’t release the GPS and the NETWORK to your app, this would be necessary:

  • 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" />
    
  • State 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 believe that android.permission.ACCESS_COARSE_LOCATION already solves the issue of GPS, but if still accuses 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 the internet network
  • ACCESS_FINE_LOCATION is based on GPS

Details in: https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started

  • could you let me know if moPub it is necessary to create an advertising network or it has its own advertisement?

  • @Rodolfo can’t tell you for sure, but I think you manage ads after you sign up at https://app.mopub.com/account/register/ then you log in https://app.mopub.com/account/login/? next=/Dashboard/ - On Dashboard you will have the control and even the own "Analytics" and monetary control. You probably have "net" and can register your own ads, but I’m not sure. Good luck.

  • when you create the ad it looks like this in Orders MoPub Demo Order I believe to work the ads should stay MoPub Demo Order Marketplace but thanks for the answer

  • @Rodolfo is this problem goes beyond what you asked, I think you better create a new question facing the problem now.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.