2017-07-27 15 views
-1

私はFirebase Performance MonitoringをAndroidスタジオプロジェクトに追加しようとしています。私はそれを私のアプリケーションに追加する方法の手順に従った後、私は自分のアプリをコンパイルできません。これはエラーです:Firebaseのパフォーマンスでコンパイルできません。 (方法が見つかりません...)

Error:(1, 0) Unable to find method 'com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V'.
Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

プロジェクトbuild.gradle:

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

buildscript { 
    repositories { 
     jcenter() 
     google() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha7' 
     classpath 'com.google.gms:google-services:3.1.0' 
     classpath 'com.google.firebase:firebase-plugins:1.1.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

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

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

// Define versions in a single place 
ext { 
    // Sdk and tools 
    minSdkVersion = 16 
    targetSdkVersion = 26 
    compileSdkVersion = 26 
    buildToolsVersion = '26.0.0' 

    sourceCompatibility = JavaVersion.VERSION_1_8 
    targetCompatibility = JavaVersion.VERSION_1_8 

    // Version 
    versionCode = 1; 
    versionName = "0.0.1"; 

    ... 

    // Firebase 
    firebaseVersion = '11.0.2' 

    ... 
} 

アプリケーションbuild.gradle:

apply plugin: 'com.android.application' 
apply plugin: 'com.google.firebase.firebase-perf' 

android { 
    compileSdkVersion rootProject.ext.compileSdkVersion 
    buildToolsVersion rootProject.ext.buildToolsVersion 

    defaultConfig { 
     applicationId "REMOVED" 
     minSdkVersion rootProject.ext.minSdkVersion 
     targetSdkVersion rootProject.ext.targetSdkVersion 
     versionCode rootProject.ext.versionCode 
     versionName rootProject.ext.versionName 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 

     vectorDrawables.useSupportLibrary = true 
     dataBinding.enabled = true 
    } 
    compileOptions { 
     sourceCompatibility = rootProject.ext.sourceCompatibility 
     targetCompatibility = rootProject.ext.targetCompatibility 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    ... 

    // Firebase 
    compile "com.google.firebase:firebase-core:$rootProject.firebaseVersion" 
    compile "com.google.firebase:firebase-perf:$rootProject.firebaseVersion" 

    ... 
} 

apply plugin: 'com.google.gms.google-services' 
+0

きれいにしようとすると、プロジェクト –

+0

@MartinDeSimoneただ、試してみましたクリーンなプロジェクトを再構築し、それは同じエラーなります「:アプリ」(1、1)の問題は、プロジェクトを評価起こりました。 > com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String; Ljava/lang/Object; Ljava/lang/Object; Ljava/lang/Object; Ljava/lang/Object;)V' –

+0

ライブラリは私が意味する –

答えて

2

あなたはおそらくあなたのbuildscriptの依存関係にfirebaseを持っていました。

問題は、私は私のbuildscriptの依存関係にfirebase持っていたということでしたので、このようなものに見えた:あなたはきれいにする必要がありその後

classpath ('com.google.firebase:firebase-plugins:1.1.0') { 
    exclude group: 'com.google.guava', module: 'guava-jdk5' 
} 

buildscript { 
    ext.kotlin_version = '1.1.3-2' 
    apply from: 'dependencies.gradle' 
    repositories { 
     ... 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha6' 
     classpath ('com.google.firebase:firebase-plugins:1.1.0') //the firebase line 
     .... 
    } 
} 

はこれでfirebaseクラスパスラインを交換しますプロジェクトは、gradleデーモンを殺し、アンドロイドスタジオを再起動します。 `エラー:

Unable to find method (can't compile project) after gradle update

+0

私は自分の携帯デバイス上にあったので、それは簡単でした –

関連する問題