Quando você instala o plugin do mopub
no Android Studio você escolhe o tipo de anuncio banner e ele te da todo código para você ir colando no lugar certo.
Você executa funciona certinho aparece no anuncio teste, ai você vai no site e cria o banner pega chave e troca a que esta no programa , ai testei no celular físico e anuncio não aparece, tem mais configuração a fazer?
O erro apareceu no 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) 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 sobre 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/NomeDaPeckage. D/MoPub﹕ Loading url: http://ads.mopub.com/m/ad?v=6&id=Minha.Key&nv=3.8.0%2Bkit&dn=unknown%2Csdk%2Csdk&bundle=NomeDaPeckage.&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.
Com chave teste funciona.
Será que isso tem alguma coisa a ver, no site parece que da para testar, veja a imagem abaixo.
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>
MoPub
? Provavelmente, está aparecendo algum erro ao tentar inicializar o seu anúncioAndroid
no rodapé do Android Studio, selecionelogcat
e, no campo de pesquisa, digiteMoPub
. Veja se aparece algo06-18 16:10:53.919 13727-13727/system_process E/cutils-trace﹕ Error opening trace file: No such file or directory (2)