2

Я пытаюсь создать проект, но это сообщение об ошибке, которое я получаю.Не удалось решить: com.firebase: firebase-jobdispatcher: 0.5.0

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> 

Как это можно решить? Я также не получаю ресурсов в Интернете.

ответ

6

Он упоминается в библиотеках github:

Если вы не имеете зависимости от com.google.android.gms: играть-сервисы гсм, добавьте следующие строки в сборки. зависимости раздела Gradle в:

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

в противном случае добавьте следующее:

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

И я не вижу зависимости от gms в файле gradle. Поэтому вы должны использовать вторую зависимость.

Обновление (май 2017 года): Вторая зависимость была удалена из документации. Теперь он должен работать только с этой зависимостью: compile 'com.firebase:firebase-jobdispatcher:0.5.2'.

+0

Большое спасибо. Это сработало для меня. :) –

Смежные вопросы