2016-05-08 3 views
0

を見つけることができませんでした7 https://codelabs.developers.google.com/codelabs/android-testing/#6アンドロイド試験工程に私は指示に従うことをしようとしているサポート-annotations.jar

はレポをクローン:git clone https://github.com/googlecodelabs/android-testing.git -b step-7

私は、注釈をサポートするために、すべての参照を削除するにもかかわらず、 Gradleでは、同じエラーを与え、停止します。

Error:A problem occurred configuring project ':app'. 
> Could not find support-annotations.jar (com.android.support:support-annotations:23.1.1). 
    Searched in the following locations:  file:/C:/Users/UserName/Documents/android_studio/sdk/extras/android/m2repository/com/android/support/support-annotations/23.1.1/support-annotations-23.1.1.jar 

build.gradleファイル:

apply plugin: 'com.android.application' 

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

     defaultConfig { 
      applicationId "com.example.android.testing.notes" 
      minSdkVersion rootProject.ext.minSdkVersion 
      targetSdkVersion rootProject.ext.targetSdkVersion 
      versionCode 1 
      versionName "1.0" 

      testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' 
     } 

     buildTypes { 
      debug { 
       // Run code coverage reports by default on debug builds. 
       // testCoverageEnabled = true 
      } 
     } 

     // If you need to add more flavors, consider using flavor dimensions. 
     productFlavors { 
      mock { 
       applicationIdSuffix = ".mock" 
      } 
      prod { 

      } 
     } 

     // Remove mockRelease as it's not needed. 
     android.variantFilter { variant -> 
      if(variant.buildType.name.equals('release') 
        && variant.getFlavors().get(0).name.equals('mock')) { 
       variant.setIgnore(true); 
      } 
     } 

     // Always show the result of every unit test, even if it passes. 
     testOptions.unitTests.all { 
      testLogging { 
       events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' 
      } 
     } 
    } 

    /* 
    Dependency versions are defined in the top level build.gradle file. This helps keeping track of 
    all versions in a single place. This improves readability and helps managing project complexity. 
    */ 
    dependencies { 
     // App's dependencies, including test 
     compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" 
     compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" 
     compile "com.android.support:design:$rootProject.supportLibraryVersion" 
     compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" 
     compile "com.android.support:support-v4:$rootProject.supportLibraryVersion" 
     compile "com.google.guava:guava:$rootProject.guavaVersion" 
     compile "com.github.bumptech.glide:glide:$rootProject.glideVersion" 
     compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.ext.espressoVersion" 

     // Dependencies for local unit tests 
     testCompile "junit:junit:$rootProject.ext.junitVersion" 
     testCompile "org.mockito:mockito-all:$rootProject.ext.mockitoVersion" 
     testCompile "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion" 
     testCompile "org.powermock:powermock-module-junit4:$rootProject.ext.powerMockito" 
     testCompile "org.powermock:powermock-api-mockito:$rootProject.ext.powerMockito" 

     // Android Testing Support Library's runner and rules 
     androidTestCompile "com.android.support.test:runner:$rootProject.ext.runnerVersion" 
     androidTestCompile "com.android.support.test:rules:$rootProject.ext.runnerVersion" 

     // Espresso UI Testing dependencies. 
     androidTestCompile "com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoVersion" 
     androidTestCompile "com.android.support.test.espresso:espresso-contrib:$rootProject.ext.espressoVersion" 
     androidTestCompile "com.android.support.test.espresso:espresso-intents:$rootProject.ext.espressoVersion" 
    } 

    /* 
    Resolves dependency versions across test and production APKs, specifically, transitive 
    dependencies. This is required since Espresso internally has a dependency on support-annotations. 
    */ 
    configurations.all { 
     resolutionStrategy.force "com.android.support:support-annotations:$rootProject.supportLibraryVersion" 
    } 

    /* 
    All direct/transitive dependencies shared between your test and production APKs need to be 
    excluded from the test APK! This is necessary because both APKs will contain the same classes. Not 
    excluding these dependencies from your test configuration will result in an dex pre-verifier error 
    at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497) 
    */ 
    configurations.compile.dependencies.each { compileDependency -> 
     println "Excluding compile dependency: ${compileDependency.getName()}" 
     configurations.androidTestCompile.dependencies.each { androidTestCompileDependency -> 
      configurations.androidTestCompile.exclude module: "${compileDependency.getName()}" 
     } 
    } 
+1

私はプロジェクトをクローン化し、正常にビルド&実行することができました。エラーが発生したら何をしていますか? – Michiyo

+0

はい、私は最後にプロジェクトをコンパイルできました。 アンドロイドスタジオ2.1です。驚いたことに、私がすべてのプロジェクトに対して同じエラーを出しているのは、彼らがサポートを探しているかどうかにかかわらず、注釈の有無です。 キャッシュを再確認し、すべてのSDKリポジトリを更新しました。アンドロイドスタジオを再起動しました。それは働いた。ありがとう。 – nexDev

答えて

0

は、依存関係をインストールしてください:

echo y | android update sdk --no-ui --all --filter extra-google-google_play_services,extra-google-m2repository 

gradle dependencies 
0

enter image description here

更新アンドロイドサポートリポジトリパッケージ

関連する問題