缺少与Android configchanges的adactivity

时间:2014-12-12 07:40:53

标签: android xml admob android-manifest google-play-services

的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>

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    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"/>

使用android configchanges

缺少adactivity

我尝试使用谷歌解决问题,不起作用。 谷歌的官方指南也没有帮助。 通过主要活动创建

帮助。 ;ç

1 个答案:

答案 0 :(得分:0)

Android Manifest xml文件无效,因为您关闭了活动代码两次。如果您使用<activity关闭/>代码,则无需在之后关闭</activity>。 理论上,在运行应用程序之前,IDE应该已经抱怨过。

所以就这样做:

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

而不是:

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