【问题标题】:App crash when implement google playservice实现 google playservice 时应用程序崩溃
【发布时间】:2018-11-24 16:16:31
【问题描述】:

当我将谷歌播放服务广告的实现插入到 gradle 时,我的应用程序崩溃了.. 我的依赖项如下所示:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.google.android.gms:play-services-ads:17.1.1'
}

【问题讨论】:

    标签: android-studio gradle


    【解决方案1】:

    我得到了这些并导入了......

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.google.android.gms:play-services-ads:17.1.1'
    implementation'com.android.support:animated-vector-drawable:27.1.1'
    implementation'com.android.support:customtabs:27.1.1'
    implementation'com.android.support:support-media-compat:27.1.1'
    implementation'com.android.support:support-v4:27.1.1'
    

    【讨论】:

      【解决方案2】:

      在实现'com.google.android.gms:play-services-ads:17.1.1' 之后,您还必须将以下内容插入到您的AndroidManifest.xml 中。

      有关App ID (a-app-pub-3940256099942544~3347511713) 的更多信息,请参阅https://developers.google.com/admob/android/quick-start

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-07-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多