2017-06-23 14 views
7

Tôi đang nâng cấp Android Studio, Gradle phiên bản 2.3 lên 2.3.3, cũng đã cập nhật sdk - API cấp 26, công cụ xây dựng SDK của tôi 26, Google play Service 41, Google Repository 54.Không thể giải quyết: com.google.firebase: firebase-storage-common: 11.0.1

Khi tôi làm sạch dự án của tôi, tôi nhận được lỗi này: Failed to resolve: com.google.firebase:firebase-storage-common:11.0.1

build.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion '26.0.0' 
    defaultConfig { 
     minSdkVersion 16 
     targetSdkVersion 26 
     multiDexEnabled = true 
    } 

    def applicationVersion = '1.524 20170612' 

    dexOptions { 
     preDexLibraries = false 
     javaMaxHeapSize "2g" 
    } 

    ... 


    useLibrary 'org.apache.http.legacy' 
    packagingOptions { 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'build.gradle' 
     exclude 'build.xml' 
     exclude 'META-INF/jersey-module-version' 
     exclude 'META-INF/NOTICE' 
    } 
    allprojects { 
     tasks.withType(JavaCompile) { 
      options.compilerArgs << "-Xlint:deprecation" 
     } 
    } 
} 

dependencies { 

    compile 'com.fasterxml.jackson.core:jackson-core:2.9.0.pr1' 
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.0.pr1' 
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr1' 
    compile 'com.android.support:multidex:1.0.1' 

    compile 'com.google.android.gms:play-services:11.0.1' 
    compile 'com.google.android.gms:play-services-base:11.0.1' 
    compile 'com.google.android.gms:play-services-appindexing:9.8.0' 
    compile 'com.google.android.gms:play-services-contextmanager:9.4.0' 
    compile 'com.google.android.gms:play-services-places:11.0.1' 
    compile 'com.google.android.gms:play-services-nearby:11.0.1' 
    compile 'com.google.android.gms:play-services-maps:11.0.1' 
    compile 'com.google.android.gms:play-services-ads:11.0.1' 
    compile 'com.google.android.gms:play-services-auth:11.0.1' 
    compile 'com.google.android.gms:play-services-gcm:11.0.1' 
    compile 'com.google.android.gms:play-services-analytics:11.0.1' 
    compile 'com.google.android.gms:play-services-location:11.0.1' 
    compile 'com.google.maps.android:android-maps-utils:0.4' 
    compile 'com.google.zxing:core:3.2.0' 
    compile 'com.journeyapps:zxing-android-embedded:[email protected]' 
    compile 'com.google.firebase:firebase-messaging:11.0.1' 
    compile 'com.google.firebase:firebase-core:11.0.1' 
    compile 'com.google.firebase:firebase-analytics:11.0.1' 

    compile 'com.flurry.android:analytics:6.4.2' 
    compile 'com.android.support.constraint:constraint-layout:+' 
    testCompile 'junit:junit:4.12' 
} 
apply plugin: 'com.google.gms.google-services' 
+0

Tham khảo rõ ràng tại đây, https://firebase.google.com/docs/android/setup. Tôi đã làm việc tốt với những dòng này các phụ thuộc { ..... biên dịch 'com.google.firebase: firebase-messaging: 9.6.0' biên dịch 'com.google.firebase: firebase-storage-common: 9.6. 0 ' testCompile' junit: junit: 4.12 ' } áp dụng plugin:' com.google.gms.google-services '// dưới cùng của tệp – Nandha

+0

Cảm ơn Nandha đã trả lời câu hỏi của tôi. Đã thử nó, nhưng lỗi không được giải quyết. –

Trả lời

0

Lỗi này phát sinh do trong gói GooglePlayService một số thay đổi đã xảy ra. Họ di chuyển một số tập tin lớp và có phương pháp để Firebase pacakge. Liên kết tham chiếu là: https://developers.google.com/android/guides/releases#october_2016_-_version_98 Bây giờ, cần thay đổi một số liên kết dự án trên tệp build.gradle.

apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 26 
    buildToolsVersion '26.0.0' 
    defaultConfig { 
     minSdkVersion 16 
     targetSdkVersion 26 
     multiDexEnabled = true 
    } 

    def applicationVersion = '1.20170612' 
dexOptions { 
    preDexLibraries = false 
    javaMaxHeapSize "2g" 
} 
enter code here 
lintOptions { 
    checkReleaseBuilds false 
    // Or, if you prefer, you can continue to check for errors in release builds, 
    // but continue the build even when errors are found: 
    abortOnError false 

} 

buildTypes { 
    release { 
     minifyEnabled false 
    } 
    debug { 
     minifyEnabled false 
    } 
    } 
} 
dependencies { 
compile project(':paymentGatewayCommons') 
compile project(':paypal') 
compile project(':paytm') 
compile project(':payu') 
compile 'com.fasterxml.jackson.core:jackson-core:2.9.0.pr1' 
compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.0.pr1' 
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr1' 
compile 'com.android.support:multidex:1.0.1' 
compile 'com.google.android.gms:play-services-base:11.0.1' 
compile 'com.google.android.gms:play-services-cast-framework:11.0.1' 
compile 'com.google.android.gms:play-services-places:11.0.1' 
compile 'com.google.android.gms:play-services-nearby:11.0.1' 
compile 'com.google.android.gms:play-services-maps:11.0.1' 
compile 'com.google.android.gms:play-services-ads:11.0.1' 
compile 'com.google.android.gms:play-services-auth:11.0.1' 
compile 'com.google.android.gms:play-services-gcm:11.0.1' 
compile 'com.google.android.gms:play-services-analytics:11.0.1' 
compile 'com.google.android.gms:play-services-location:11.0.1' 
compile 'com.google.maps.android:android-maps-utils:0.4.+' 
compile 'com.google.zxing:core:3.2.0' 
compile 'com.journeyapps:zxing-android-embedded:[email protected]' 
compile 'com.google.firebase:firebase-appindexing:11.0.1' 
compile 'com.google.firebase:firebase-messaging:11.0.1' 
compile 'com.google.firebase:firebase-core:11.0.1' 
compile 'com.google.firebase:firebase-analytics:11.0.1' 
compile 'com.flurry.android:analytics:6.4.2' 
compile 'com.android.support.constraint:constraint-layout:+' 


    testCompile 'junit:junit:4.12' 
} 
apply plugin: 'com.google.gms.google-services' 

Ngoài ra thay đổi trong dự án chính tập tin build.gradle

dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
     classpath 'com.google.gms:google-services:3.1.0' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
2

Hãy chắc chắn rằng từ nhóm com.google.android.gms và từ nhóm com.google.firebase có cùng phiên bản.

Ví dụ: phiên bản mới nhất hiện tại là 11.0.1, do đó tất cả các phụ thuộc từ com.google.android.gmscom.google.firebase sẽ có phiên bản 11.0.1. Trong danh sách dependencies của bạn sau hai danh sách có phiên bản khác. Hãy chắc chắn rằng họ cũng có phiên bản 11.0.1.

Đối với việc đạt được mà

Bạn sẽ cần phải di chuyển Chơi dịch vụ App lập chỉ mục để căn cứ hỏa lực App lập chỉ mục. Hướng dẫn là here.

Theo Google Awareness API v9.6 is missing api bối cảnh đã được đổi thành Awareness API. Vì vậy, bạn cũng sẽ cần phải cập nhật mã của bạn cho phù hợp.

+0

Xin chào BhalchadraSW, Cảm ơn bạn đã trả lời câu hỏi của tôi. Khi tôi kiểm tra trên đĩa cứng của tôi Android/sdk/extras/google/m2repository/com/google/androd/gms/play-servies-appindexing: 9.8.0 là phiên bản mới nhất tải về. Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-contextmanager: 9.4.0 cũng là phiên bản mới nhất được tải xuống. Google không cung cấp phiên bản 11.0.1 cho điều đó. –

+0

Tôi nghĩ rằng vì bạn nên di chuyển sang [firebase appindexing] (https://firebase.google.com/docs/app-indexing/android/migrate) – BhalchandraSW

+0

Cộng với bối cảnh di chuyển sang [API nhận thức] (https://developers.google) .com/nhận thức/tổng quan) – BhalchandraSW

6

căn cứ hỏa lực doc nói:

Getting a "Could not find" error? Make sure you have the latest Google Repository in the Android SDK manager

Bạn có thể kiểm tra phiên bản Google Repository (trong Linux):

enter image description here

1

Phương pháp tốt nhất để khắc phục sự cố này không sử dụng phương pháp thủ công để liên kết Firebase với ứng dụng của bạn.

Tôi đã thử thêm repo firebase mới nhất bằng cách tham chiếu đến số Link này.

Nó cho thấy lỗi "thất bại trong việc giải quyết sự phụ thuộc"

căn cứ hỏa lực khuyến nghị bổ sung căn cứ hỏa lực để ứng dụng của bạn với sự giúp đỡ của căn cứ hỏa lực Assistant for Android Studio Version 2.2 và cao hơn. Thêm thủ công thư viện mới nhất vào build-gradle (module) dẫn đến lỗi như trên.

Sử dụng trợ lý Firebase quá dễ dàng và quá trình 2 bước. Để tham khảo, bạn có thể sử dụng phần "Sử dụng Trợ lý Firebase" trên cùng một liên kết được đề cập ở trên.

Nó thực sự hiệu quả với Android Studio 2.3.3

Các vấn đề liên quan