missing adactivity with android configchanges

别等时光非礼了梦想. 提交于 2020-01-06 13:55:19

问题


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

missing adactivity with android configchanges

I tried to solve the problem using google , does not work. The official guide from google too did not help. Created through the mainactivity

Help. ;c


回答1:


The Android Manifest xml file is invalid, because you close your activity tag twice. If you close the <activity tag with /> then you don't need to put the closing </activity> after. In theory your IDE should have complained about that already before you run the app.

So just do:

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

instead of:

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


来源:https://stackoverflow.com/questions/27438963/missing-adactivity-with-android-configchanges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!