2017-08-12 20 views
1

Androidスタジオプロジェクトでエラーが見つかりました。Androidスタジオエラー - 解決できませんでした:com.google.android.gms:play-services-ads

Error:(29, 13) Failed to resolve:com.google.android.gms:play-services-ads:+ Install Repository and sync project

と私はインストールリポジトリとの同期プロジェクトをクリックしたときには示しています:それは示し

enter image description here

私は何をすべきか?

マイXML -

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.hanumanbeniwal.www.hanumanbeniwal.MainActivity"> 

    <WebView 
     android:id="@+id/WebView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

     <com.google.android.gms.ads.AdView 
      android:id="@+id/adView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_x="586dp" 
      android:layout_y="948dp" /> 
    </WebView> 

</android.support.constraint.ConstraintLayout> 

MY Javaコーディング -

package com.hanumanbeniwal.www.hanumanbeniwal; 
 

 
import android.support.v7.app.AppCompatActivity; 
 
import android.os.Bundle; 
 
import android.webkit.WebSettings; 
 
import android.webkit.WebView; 
 
import android.webkit.WebViewClient; 
 

 
public class MainActivity extends AppCompatActivity { 
 
    public WebView myWebView; 
 

 
    @Override 
 
    protected void onCreate(Bundle savedInstanceState) { 
 
     super.onCreate(savedInstanceState); 
 
     setContentView(R.layout.activity_main); 
 

 
     myWebView =(WebView)findViewById(R.id.WebView); 
 
     WebSettings webSettings = myWebView.getSettings(); 
 
     webSettings.setJavaScriptEnabled(true); 
 
     webSettings.setAppCacheEnabled(true); 
 
     myWebView.loadUrl("http://www.hanumanbeniwal.com/"); 
 
     myWebView.setWebViewClient(new WebViewClient()); 
 
    } 
 
    @Override 
 
    public void onBackPressed() { 
 
     
 
    } 
 
}
マイ build.gradle (プロジェクト)それを確認してください...
apply plugin: 'com.android.application' 
 

 
android { 
 
    compileSdkVersion 26 
 
    buildToolsVersion "26.0.0" 
 
    defaultConfig { 
 
     applicationId "com.hanumanbeniwal.www.hanumanbeniwal" 
 
     minSdkVersion 14 
 
     targetSdkVersion 26 
 
     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:26.+' 
 
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7' 
 
    testCompile 'junit:junit:4.12' 
 
    compile 'com.google.android.gms:play-services-ads:+' 
 
}
マイ builed.gradle (モジュール:アプリ)それをチェックしてください...
// 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.3.3' 
 

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

答えて

0

あなたはへのアプリケーション・レベルのbuild.gradleを更新する必要があります。これはあなたを助けるかもしれない

classpath 'com.google.gms:google-services:3.0.0' from 2.x.x.

+1

エラー:(1、0)IDが 'com.android.application'のプラグインが見つかりません。私は何をすべきか ? –

+0

プロジェクトレベルのbuild.gradleファイルを確認してください。 'リポジトリ'セクションに欠けているものがないか確認してください。 –

+0

私はチェックして、私の質問とbuild.gradleファイルを添付しているので、それを確認し、私の問題を解決してください。 –

関連する問題