在whatsapp贴纸应用上执行admob

时间:2018-12-05 16:44:30

标签: android

我会尽我所能地做到具体。 首先,我是新手 我已经创建了可以正常使用的whatsapp贴纸应用,然后我想投放一些广告来赚钱,依此类推,我一直在搜索很多Google,YouTube等内容,并决定开始这一过程 第一次尝试失败的原因未知。 第二,第三和第四仍然每次都会使应用程序崩溃

我不知道的是我必须在我的java文件夹中添加新活动还是使用现有的任何活动

,我是否必须为广告创建新的布局或使用现有的任何布局 我正在使用[https://github.com/WhatsApp/stickers]

这是我的依赖

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.fresco:fresco:1.11.0'
implementation 'com.facebook.fresco:webpsupport:1.11.0'
implementation 'com.facebook.fresco:animated-webp:1.11.0'
implementation 'com.facebook.fresco:webpsupport:1.11.0'

这是我的Gradle.android

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的androidmanifest

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

    <application
        android:allowBackup="false"
        android:fullBackupContent="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:name=".StickerApplication"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ca-app-pub-7344222011487890~7694606742]"/>
        <activity android:name=".EntryActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".StickerPackListActivity"
            android:label="@string/title_activity_sticker_packs_list" />
        <activity
            android:name=".StickerPackDetailsActivity"
            android:parentActivityName=".StickerPackListActivity"
            tools:ignore="UnusedAttribute">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.samplestickerapp.StickerPackListActivity" />
        </activity>
        <activity
            android:name=".StickerPackInfoActivity"
            android:label="@string/title_activity_sticker_pack_info"
            android:parentActivityName=".StickerPackDetailsActivity"
            tools:ignore="UnusedAttribute">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.samplestickerapp.StickerPackDetailsActivity" />
        </activity>

        <provider
            android:name=".StickerContentProvider"
            android:authorities="${contentProviderAuthority}"
            android:enabled="true"
            android:exported="true"
            android:readPermission="com.whatsapp.sticker.READ" />
    </application>
</manifest>

如果您想了解更多信息,请帮助我,我会发布我能提供的信息

1 个答案:

答案 0 :(得分:0)

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ca-app-pub-7344222011487890~7694606742]"/>

Youre supposed to remove those on android:value -> "[..]"
So it'll look like this:

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-7344222011487890~7694606742"/>