2012-10-06 25 views
5

मुझे नहीं पता कि यह त्रुटि कैसे आती है, जब मैं इसे कई बार कोशिश करता हूं, इसलिए मैंने स्टैक ओवरफ्लो में भिन्न पोस्ट देखा लेकिन मुझे समाधान मिल गया। तो इसके बाद मैं इस समस्या को पोस्ट करता हूं। मेरे पास 2.3.3 एंड्रॉइड ऐप है जो मैं विकसित कर रहा हूं कि मैं एडमोब विज्ञापन जोड़ना चाहता हूं। मेरे त्रुटियों:यह क्यों है "आपको AndroidManifest.xml में configChanges के साथ घोषित विज्ञापन गतिविधि होना चाहिए।"

enter image description here

यहाँ मेरी जावा फ़ाइलें है>

package com.example.admobtest; 

import android.os.Bundle; 
import android.app.Activity; 

import com.google.ads.*; 

public class MainActivity extends Activity { 
    private AdView adView; 

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

     // Create the adView 
     adView=(AdView) findViewById(R.id.adView); 

     // Initiate a generic request to load it with an ad 
     adView.loadAd(new AdRequest()); 
    } 

} 

और main.xml फ़ाइलों

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="17dp" 
     ads:adSize="BANNER" 
     ads:adUnitId="**************" 
     ads:loadAdOnCreate="true" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="@string/hello_world" 
     tools:context=".MainActivity" /> 

</RelativeLayout> 

चित्रमय लेआउट में

निम्नलिखित वर्गों instantiated नहीं किया जा सकता है: - com.google.ads.AdView (ओपन क्लास, शो त्रुटि लॉग) अधिक जानकारी के लिए त्रुटि लॉग (विंडो> दिखाएं देखें) देखें।

अंत में AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.admobtest" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="10" /> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/title_activity_main" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation" /> 
    </application> 

</manifest> 

यहाँ में मैं भी android:configChanges="keyboard|keyboardHidden|orientation" के बजाय इस android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" कोशिश लेकिन प्रभाव नहीं करता है।

और मैं GoogleAdMobAdsSdk-6.1.0.jar बाहरी जार फ़ाइलों से जोड़ता हूं।

उत्तर

1

समस्या को ठीक करने के लिए आपको अपने प्रोजेक्ट बिल्ड लक्ष्य को एंड्रॉइड 3.2 या उच्चतम पर सेट करना होगा।

इस लिंक पर अधिक जानकारी देखें।

https://developers.google.com/mobile-ads-sdk/docs/ (एंड्रॉयड टैब देखें)

+0

धन्यवाद मेरी समस्या हल,। –

0

मुझे लगता है कि आप मेटा डेटा टैग

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

लापता मैं आशा करता हूँ कि मदद करता है

संबंधित मुद्दे