我的程序崩溃了:
#0 0x3138cec0 in objc_msgSend
#1 0x0002bb6e in -[AdMobDelegateWrapper didYouNilOutYourDelegate:]
#2 0x0002c392 in -[AdMobDelegateWrapper publisherId]
#3 0x0001ab7e in -[AdMobAd buildParamsWithLastClickInfo:]
#4 0x0001b044 in -[AdMobAd requestAdFromServer]
#5 0x0001963c in -[AdMobAd browserIconsDidFinishLoading]
#6 0x0001a23e in -[AdMobAd downloadDidSucceed:]
#7 0x323fba14 in -[NSObject performSelector:withObject:]
#8 0x0002122e in -[AdMobURLDownload performRequest:]
#9 0x33731acc in -[NSThread main]
#10 0x336dfd14 in __NSThread__main__
#11 0x33ad8788 in _pthread_body
Run Code Online (Sandbox Code Playgroud)
为什么?
我使用4.0 SDK,设备的系统版本是iOS 3.1.3.
我的代码非常简单,来自"admob_iphone_sdk_20100818"中的示例.
我是android新手编程的新手.我遵循了指示并创建了一个admob横幅.如何让它以特定的间隔出现,如果我愿意,它会消失?例如,admob横幅可以随时在屏幕底部上下移动.谢谢.
编辑:
我知道我可以打电话adView.setVisibility( View.GONE );让广告显示和消失,但当我尝试将其写入一个线程使其显示并消失时间间隔时,它只是挂在那里黑屏.
或者,无论如何,admob可以让他们的广告每隔一段时间出现和消失?
这就是我调用线程的方式.
loadAdmob = new asyncAdmobProc();
loadAdmob.execute();
loadAdmob.doInBackground();//asyncAdmobProc();
Run Code Online (Sandbox Code Playgroud)
代码:
//wakes up the admob
private class asyncAdmobProc extends AsyncTask<Integer , Void, Integer> {
private boolean bconthread=true;
protected Integer doInBackground(Integer... Params) {
//wakes up and disable admob
/*AdManager.setTestDevices( new String[] {
AdManager.TEST_EMULATOR, // Android emulator
"E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone
} );//*/
adView = (AdView)findViewById(R.id.articleList_ads);
adView.requestFreshAd();
adView.setVisibility( View.GONE );
//while(bconthread){
adView.requestFreshAd();
ShowAd();
postDelayed();
//HideAd();
postDelayed();
//}
//call this to delete all bitmaps associated …Run Code Online (Sandbox Code Playgroud) 我知道,只有一定的填充率才能吸收.但是我想要展示一些东西,否则会让我的UI不一致.我尝试启用"自家广告",但有时广告栏仍未填充.
有没有办法强迫admob展示一些广告?我相信展示更多广告对他们来说只是一件好事.否则,我可以手动检查是否没有广告返回?因此,我可以用自己的装饰条替换广告栏.
谢谢,
我使用的是Android的AdMob SDK的4.3.1和我使用XML来创建布局作为解释这里使用Eclipse IDE中.问题是eclipse无法识别com.google.ads.AdView标记并给出错误错误:解析XML时出错:未绑定的前缀.我该如何解决?
编辑 -这是布局文件的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR,e78b974e6ab65648b52951e69edcb571"
ads:loadAdOnCreate="true"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我已经使用了admob sdk并添加了外部jar.In xml我指定了
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/headerfield"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="Publisher Id"
ads:loadAdOnCreate="true" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
表现
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
Run Code Online (Sandbox Code Playgroud)
但在图形模式下它给我一个错误日志:
com.google.ads.AdView - the following class could not be instantiated.
Run Code Online (Sandbox Code Playgroud)
程序里面显示它
您必须在AndroidManifest.xml中使用configChanges声明AdActivity.
我的应用使用了以下InterstitialAd,以下是从Google示例中获得的标准编码.但是,我想问为什么没有广告节目?(该应用程序正确显示吐司:在ReceiveAd上)
我的main_first_page布局底部也有一个广告横幅.这会影响InterstitialAd吗?
谢谢!!
public class StartUp extends Activity implements AdListener {
private InterstitialAd interstitialAd;
AdView adView;
private static final String LOG_TAG = "IQ!";
public static final String MY_PUBLISHER_ID = "abc";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); // call the superclass's method
setContentView(R.layout.main_first_page); // inflate the GUI
Button ButtonNum= (Button) findViewById(R.id.buttonB);
Button ButtonHeart= (Button) findViewById(R.id.buttonC);
Button ButtonMath= (Button) findViewById(R.id.buttonD);
interstitialAd = new InterstitialAd(this, MY_PUBLISHER_ID); // Create an ad.
interstitialAd.setAdListener(this); // Set the AdListener.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
interstitialAd.loadAd(adRequest); …Run Code Online (Sandbox Code Playgroud) 我尝试了很多组合,但它在xml文件中显示以下错误
错误:解析XML时出错:未绑定的前缀
在<com.google.ads.AdView行,我怎么能解决这个问题.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:adUnitId="000000000000000"
myapp:adSize="BANNER"
myapp:refreshInterval="30"
/>
</RelativeLayout>
<ListView
android:id="@+id/list_of_wishes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="2dip"
android:clickable="true" >
</ListView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 所以我在Android Studio v 0.3.6上,我遇到了Google Play服务的问题.我已经在我的项目中使用Admob jar但我必须更新它,所以我尝试通过说明添加它们.我的项目编译正常但是当我尝试运行一个活动时,我收到以下错误:
Didn't find class "com.google.ads.AdView" on path: /data/app/com.mre. example-1. apk
Run Code Online (Sandbox Code Playgroud)
请参阅此处的完整错误输出.我的build.gradle的相关部分:
apply plugin: 'android'
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile 'com.google.android.gms:play-services:4.0.30'
//compile project(':libraries:google-play-services_lib')
//compile files('libs/google-play-services.jar')
...
}
android {
compileSdkVersion 18
buildToolsVersion '18.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的清单
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"ex">
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="@string/app_id" />
...
<activity
android:name="com.google.ads.AdActivity" …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个基本的libgdx应用程序,并且没有显示广告.我正在关注这些指南:https: //developers.google.com/android/guides/setup
https://developers.google.com/admob/android/eclipse
https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx
代码非常基本,只是从libgdx指南中复制的代码.代码有效,但广告未显示.
为Android实施AdMob奖励视频广告我看到,当用户在获得奖励之前关闭广告时,会显示图片中的以下消息.有谁知道是否有可能改变那条消息?例如,"You won't earn 30 coins"而不是You will lose your reward".