ApolloGraphql FileNotFoundException:源/ apollo /生成IR /调试/ src(是一个目录)

时间:2018-07-26 13:51:38

标签: android kotlin graphql apollo

我正在尝试将ApolloGraphql添加到我的android项目中,但是当我尝试重建该项目时,我得到了:

service cloud.firestore {
match /{multi_path=*} {
match /{multi_path=**} {
  allow read, write
    }
  }
}

在build.gradle中,我添加了所需的依赖项:

org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /Users/mcebotari/Downloads/Projects/Barcloud/app/build/generated/source/apollo/generatedIR/snapshotDebug/src (Is a directory)

以及依赖项:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

apply plugin: 'com.apollographql.android'


android {
  compileSdkVersion 27
  defaultConfig {
    applicationId "barcloud.com"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.android.support:design:27.1.1'

  //Design
  implementation 'com.github.rasoulmiri:buttonloading:v1.0.8'

  //Vision Library
  implementation 'com.google.android.gms:play-services-vision:15.0.2'

  // RxJava
  implementation "io.reactivex.rxjava2:rxjava:2.1.16"
  implementation "io.reactivex:rxandroid:1.2.1"
  implementation "com.jakewharton.rxbinding:rxbinding:1.0.1"
  implementation "com.squareup.retrofit2:adapter-rxjava:2.3.0"
  implementation 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:1.0.1'

  //RxPermissions
  implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'

  //Retrofit
  implementation "com.squareup.retrofit2:retrofit:2.4.0"
  implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"
  implementation "com.squareup.retrofit2:converter-gson:2.4.0"

  // rxandroid
  implementation "io.reactivex.rxjava2:rxandroid:2.0.1"

  // Dagger
  implementation "com.google.dagger:dagger:2.12"
  kapt "com.google.dagger:dagger-compiler:2.12"

  //GraphQL
  implementation 'com.apollographql.apollo:apollo-runtime:1.0.0-alpha'
  implementation 'com.apollographql.apollo:apollo-rx2-support:1.0.0-alpha'

  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

试图重建我得到的项目:

classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.0-alpha'

graphql文件是官方示例中的文件-GithuntFeedQuery.graphql及其schema.json,粘贴在主文件夹中。

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

prodRelease配置有相同的问题,已通过重命名prod样式解决。 在应用程序build.gradle中,我有:

buildTypes { 
  debug {...}
  release {...}
}
productFlavors {
  dev {...}
  stage {...}
  prod {...}
}

这给了我6个buildVariant

devDebug
devRelease
stageDebug
stageRelease
prodDebug
prodRelease

前5名在本地和CI上构建都没有问题,而prodRelease给我的错误与您所描述的相同,而没有任何逻辑解释。 GraphQL文件对于dev,stage和prod是相同的...我试图为“ prod”创建特定的文件夹,然后为“ prodRelease”创建特定的文件夹,检查它们的访问权限-所有变体都相同,没有任何帮助。并且prodDebug一直在正确构建。然后,我将重命名为prod flavour(不要忘了相应地重命名graphql files文件夹),并且现在它像一个吊饰一样工作。

答案 1 :(得分:0)

研究此问题时遇到了两种解决方案:

  1. 从项目中删除阿波罗,(by editing your gradle files)清理项目,然后再次添加阿波罗。

  2. 尝试更改项目gradle文件中的阿波罗版本, 即。我与

  3. 合作

classpath 'com.apollographql.apollo:gradle-plugin:0.3.1

,最初是0.3.2