missing adactivity with android configchanges

1,368 views
Skip to first unread message

Alexander Yam

unread,
Dec 12, 2014, 2:20:59 AM12/12/14
to google-adm...@googlegroups.com
build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"


    defaultConfig {
        applicationId "com.example.yamkatrader.myapplication"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.google.api-ads:tools:1.12.1'
}

Android Manifest

            <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
        </activity>

and 
<?xml version="1.0" encoding="utf-8"?>

    package="com.example.yamkatrader.myapplication" >
    <uses-permission android:name="android.permission.SET_DEBUG_APP"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <application

        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light" >
        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

missing adactivity with android configchanges

Help. ;c

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Dec 12, 2014, 12:38:28 PM12/12/14
to google-adm...@googlegroups.com
The error you're describing usually indicates that Android can't find the AdActivity's <activity> tag in the manifest, or that it's malformed.  I would check the following:

1) Make sure your <activity> tag is inside the <application> tag.

2) Add the theme attribute to your <activity> tag.  Here's mine:

<activity android:name="com.google.android.gms.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
    android:theme="@android:style/Theme.Translucent" />

Also, consider having a look at our Android quick start:


It can help you get started with AdViews.

-Andrew

Alexander Yam

unread,
Dec 13, 2014, 12:21:09 AM12/13/14
to google-adm...@googlegroups.com
Thanks! But the banner does not appear.

activity main.xml

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   
xmlns:tools="http://schemas.android.com/tools"
   
xmlns:ads="http://schemas.android.com/apk/res-auto"
   
android:layout_width="match_parent"
   
android:layout_height="match_parent"
   
android:paddingLeft="@dimen/activity_horizontal_margin"
   
android:paddingRight="@dimen/activity_horizontal_margin"
   
android:paddingTop="@dimen/activity_vertical_margin"
   
android:id="@+id/RelativeLayout"
   
android:paddingBottom="@dimen/activity_vertical_margin"
   
tools:context=".MainActivity"
   
android:background="#ff6b6b76"
   
android:theme="@style/Theme.AppCompat.Light">

 
<com.google.android.gms.ads.AdView android:id="@+id/adView"
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
ads:adUnitId="ca-app-pub-4820038314180872/2219406344"
       
ads:adSize="BANNER"
       
android:layout_below="@+id/inputSearch"
       
android:layout_centerHorizontal="true"
       
android:layout_marginTop="37dp" />

<EditText android:id="@+id/inputSearch"
       
android:layout_width="fill_parent"
       
android:layout_height="wrap_content"
       
android:hint="@string/search"
       
android:inputType="textVisiblePassword"/>

<ListView
       
android:id="@+id/list_view"
       
android:layout_width="fill_parent"
       
android:layout_height="wrap_content"

       
android:layout_alignParentRight="true"
       
android:layout_alignParentEnd="true"
       
android:layout_marginTop="59dp" />




</RelativeLayout>

and mainactivity

@Override
   
public void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView
(R.layout.activity_main);


        adView
= new AdView(this);
        adView
.setAdUnitId("ca-app-pub-4820038314180872/2219406344");
        adView
.setAdSize(AdSize.BANNER);


       
RelativeLayout layout = (RelativeLayout)findViewById(R.id.RelativeLayout);


        layout
.addView(adView);


       
AdRequest adRequest = new AdRequest.Builder().build();


        adView
.loadAd(adRequest);



пятница, 12 декабря 2014 г., 10:20:59 UTC+3 пользователь Alexander Yam написал:

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Dec 15, 2014, 7:00:10 PM12/15/14
to google-adm...@googlegroups.com
I'd recommend two things, then:

1) Check your log to make sure the ad is loading properly
2) Use these techniques to make sure your view hierarchy is placing the ad in a visible location: http://developer.android.com/tools/debugging/debugging-ui.html

-Andrew

Spencer

unread,
Dec 16, 2014, 10:57:07 AM12/16/14
to google-adm...@googlegroups.com
Dear Alexander

Not sure, but It has information for Banner AD.
The Key words is "How to admob" in Play Store.
There will be "AdMob ads How to add in my App" :








spencer

2014년 12월 12일 금요일 오후 4시 20분 59초 UTC+9, Alexander Yam 님의 말:

jeremie cohen

unread,
Mar 11, 2016, 8:31:48 AM3/11/16
to Google Mobile Ads SDK Developers
Hello,
i have the same problem and my code is how you described. In my app which use google map (google_play_services_lib) i have an error when i put (uiMode,screensize and smallestscreensize in android:configchanges). So i let only keyboard,keyboardhidden, orientation.... but my ads displays "Missing AdActivity with android:configChanges in AndroidManifest.xml".
How i can use admob?
thanks

SEO COM

unread,
Mar 11, 2016, 9:28:08 AM3/11/16
to google-adm...@googlegroups.com

Dear Jeremie

refer to below .





/***************************************************************************/
/******   Please Put below Source in your Code using Copy and paste  *******/
/***************************************************************************/


<!--  ------------------------------------------------------------------  -->
<!--   1. Content of Android Manifest.xml   ----------------------------  -->
<!--  ------------------------------------------------------------------  -->

    <activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|uiMode|screenLayout|screenSize|smallestScreenSize" />


    <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

<!--  ------------------------------------------------------------------  -->
<!--  ------------------------------------------------------------------  -->



<!--  ------------------------------------------------------------------  -->
<!--   2. Content of main.xml   ----------------------------------------  -->
<!--  ------------------------------------------------------------------  -->

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="MY_AD_UNIT_ID" />

<!--  ------------------------------------------------------------------  -->
<!--  ------------------------------------------------------------------  -->



/*****************************************************************************/
/******   Please Put below Function in your Code using Copy and paste  *******/
/*****************************************************************************/


/***   3.1 Call Function in a Active Function   ******************************/

    SystemAdvertisementView();



/***   3.2 Function Body   ***************************************************/

    AdView  mAdverView;
    public void SystemAdvertisementView() {
        mAdverView =(AdView)findViewById(R.id.adView);
        if( mAdverView == null ) { System.out.println("No Advertisement"); }

        AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4")
            .build();
        mAdverView.loadAd(adRequest);
    }

    @Override 
    protected void onPause() { 
        mAdverView.pause(); 
        super.onPause(); 
    } 

    @Override 
    protected void onResume() { 
        super.onResume(); 
        mAdverView.resume(); 
    } 



/***   3.3 Must call when you finish Activity or Ad   ************************/

    mAdverView.destroyDrawingCache();
    mAdverView.destroy();


--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/a1ysV38w4bY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.
To post to this group, send email to google-adm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

jeremie cohen

unread,
Mar 11, 2016, 10:06:54 AM3/11/16
to Google Mobile Ads SDK Developers
thank for the answer but "<activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|uiMode|screenLayout|screenSize|smallestScreenSize" /> " triggers an (compilation) error. That's why i putted just
<activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout" />
" but when i do that my ads display "Missing AdActivity with android:configChanges in AndroidManifest.xml". My manifest:
....

   
<uses-sdk
      android
:minSdkVersion="8"
        android
:targetSdkVersion="18" />

   
   
     
<uses-feature android:name="android.hardware.camera"/>
   
   
     
     
     
<uses-permission  android:name="android.permission.CAMERA"/>
     
     
     
           
     
     
             
   
   
     
   
   
<uses-permission  android:name="android.permission.MAPS_RECEIVE"/>  
 
<uses-permission  android:name="android.permission.ACCESS_NETWORK_STATE"/>
   
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

   
<uses-permission  android:name="android.permission.INTERNET"/>

   
<uses-permission  android:name="android.permission.CHANGE_NETWORK_STATE"/>
   
<uses-permission  android:name="android.permission.READ_PHONE_STATE"/>
     
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
   
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
   
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
   
<uses-permission android:name="android.permission.VIBRATE"/>
   
   
<permission android:name="android.permission.MAPS_RECEIVE"
        android
:protectionLevel="signature"/>

     
   
<application
        android
:allowBackup="true"
        android
:icon="@drawable/ic_launcher"

        android
:label="@string/myapp"
        android
:theme="@style/AppTheme" >
           
       
<uses-library android:name="com.google.android.maps"/>    



 
 
       
   
<activity
            android
:name=".defens"
            android
:label="@string/myapp" >
           
<intent-filter>
               
<action android:name="android.intent.action.MAIN" />

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

       

       
<activity
            android
:name=".appel"
            android
:label="@string/myapp"
             
>

       
</activity>

         
         <activity
            android:name=".MapsActivity"
            android:label="@string/
myapp"
             >
        </activity>
        <activity android:name="
com.google.android.gms.ads.AdActivity"
     android:configChanges="
keyboard|keyboardHidden|orientation|screenLayout"/>
     
        <meta-data android:name="
com.google.android.geo.API_KEY"
            android:value="
mykey"/>
        <meta-data  android:name="
com.google.android.gms.version"
            android:value="
@integer/google_play_services_version"/>
         
       
       
       
       
         
         
         </application>
</manifest>



Le vendredi 12 décembre 2014 08:20:59 UTC+1, Alexander Yam a écrit :

SEO COM

unread,
Mar 11, 2016, 10:33:47 AM3/11/16
to google-adm...@googlegroups.com
I'm not sure but

I thinks "<uses-library android:name="com.google.android.maps"/>" this makes error ?

best regards.

--

jeremie cohen

unread,
Mar 11, 2016, 2:45:28 PM3/11/16
to Google Mobile Ads SDK Developers
thank you Spencer. i fixed it, it's was kind of build problem


Le vendredi 12 décembre 2014 08:20:59 UTC+1, Alexander Yam a écrit :

SEO COM

unread,
Mar 12, 2016, 4:34:06 AM3/12/16
to google-adm...@googlegroups.com
Good!! 

Brest Regards

--
Reply all
Reply to author
Forward
0 new messages