【问题标题】:Failed to resolve: com.firebase:firebase-jobdispatcher:0.5.0无法解决:com.firebase:firebase-jobdispatcher:0.5.0
【发布时间】:2017-06-27 14:34:23
【问题描述】:

我正在尝试构建项目,但这是我收到的错误消息。

    Error:(32, 13) Failed to resolve: com.firebase:firebase-jobdispatcher:0.5.0
    Show in File
    Show in Project Structure dialog

    Error:Failed to resolve: com.android.databinding:compiler:2.2.3
    Open File
    Show in Project Structure dialog

这里是应用模块的构建文件:-

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24.0.0'

defaultConfig {
    applicationId "com.example.android.sunshine"
    minSdkVersion 10
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
    }
}

dataBinding.enabled = true
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'

compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:preference-v7:24.2.1'

compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'

compile 'com.firebase:firebase-jobdispatcher:0.5.0'

// Instrumentation dependencies use androidTestCompile
// (as opposed to testCompile for local unit tests run in the JVM)
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}

这里是完整项目模块的构建文件:-

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

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

allprojects {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
}
repositories {
    jcenter()
}
}

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

这里是 AndroidManifest.xml 文件:-

    <?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.-->
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.sunshine">

    <!-- This permission is necessary in order for Sunshine to perform network access. -->
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <!--The manifest entry for our MainActivity. Each Activity requires a manifest entry-->
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop"
            android:theme="@style/AppTheme.Forecast">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <!--The manifest entry for our DetailActivity. Each Activity requires a manifest entry-->
        <activity
            android:name=".DetailActivity"
            android:label="@string/title_activity_detail"
            android:parentActivityName=".MainActivity"
            android:theme="@style/AppTheme">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity"/>
        </activity>

        <!--The manifest entry for our SettingsActivity. Each Activity requires a manifest entry-->
        <activity android:name=".SettingsActivity"/>

        <!-- Our ContentProvider -->
        <provider
            android:name=".data.WeatherProvider"
            android:authorities="@string/content_authority"
            android:exported="false"/>

        <!--This is required for immediate syncs -->
        <service
            android:name=".sync.SunshineSyncIntentService"
            android:exported="false" />

        <!-- This is the Service declaration used in conjunction with FirebaseJobDispatcher -->
        <service
            android:name=".sync.SunshineFirebaseJobService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>
            </intent-filter>
        </service>

    </application>
</manifest>

我该如何解决这个问题?我也没有在互联网上获得任何资源。

【问题讨论】:

    标签: android firebase firebase-realtime-database firebase-storage mobile-development


    【解决方案1】:

    图书馆的github有提到:

    如果你没有依赖 com.google.android.gms:play-services-gcm,将以下内容添加到您的 build.gradle 的依赖部分:

    compile 'com.firebase:firebase-jobdispatcher:0.5.2'

    否则添加以下内容:

    compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'

    而且我在你的 gradle 文件上看不到任何对 gms 的依赖。所以你应该使用第二个依赖。

    更新(2017 年 5 月):第二个依赖项已从文档中删除。它现在应该只使用这个依赖: compile 'com.firebase:firebase-jobdispatcher:0.5.2'.

    【讨论】:

      猜你喜欢
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 2018-11-06
      • 1970-01-01
      • 2018-06-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-11
      相关资源
      最近更新 更多