2016-12-17 10 views
1

私はadmob報酬ビデオ広告を統合しようとしています。私は空のproject.Alsoを持っていますthis specに従ってfirebase SDKを統合しました。しかし、AdViewクラスを入力するとアンドロイドスタジオはそれを見ませんandroid studioがadViewクラスを解決できない

ルート:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

    buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.3' 
    classpath 'com.google.gms:google-services:3.0.0' 
    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
} 
    } 

    allprojects { 
repositories { 
    jcenter() 
} 
} 

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

アプリレベル:

apply plugin: 'com.android.application' 
android { 
compileSdkVersion 24 
buildToolsVersion "24.0.2" 
defaultConfig { 
    applicationId "com.rhyboo.net.rewarded_video" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:24.2.1' 
testCompile 'junit:junit:4.12' 
} 
apply plugin: 'com.google.gms.google-services' 
.Package com.google.android.gms.adsAdRequestまたは MobileAds .MYのGradleファイルのような広告のクラスが含まれていません

答えて

1

をブロックします。

ただ、これらの行を追加します。

compile 'com.google.firebase:firebase-core:10.0.1' 
compile 'com.google.firebase:firebase-ads:10.0.1' 

あなたのbuild.gradleの依存関係に:FirebaseでのAdMobをインポートする適切な方法です

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' // new! 
    compile 'com.google.firebase:firebase-ads:10.0.1' // new! 
    testCompile 'junit:junit:4.12' 
} 

を。ウォークスルーについてはthis videoをご覧ください。

+1

まあ、私はこれらの依存関係があると確信していました。現在、私は 'I/FirebaseInitProvider:firebaseApp initialization successful'をconsole.Andに持っていて、Googleプレイサービスをもうインポートする必要はありません。 – undefined

0

アプリレベルの依存関係にcompile 'com.google.android.gms:play-services:10.0.1'を追加するのを忘れ、あなたがFirebase、あなたが使用している個々のサービスのためのライブラリを追加することで、ガイドからの最後のステップを逃したように見えます

+0

これは、Google Playサービスを取得します。これは、Firebaseと同じではありません。モバイル広告SDKも含まれていますが、これにはAdViewクラスが含まれています。 – RedBrogdon

関連する問題