1 android apollo graphql android-studio-2.3 graphql-java
我从波纹管样品中使用,但添加库时出现错误:
贝娄是我的build.gradle (project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.apollographql.android:gradle-plugin:0.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
贝娄是我的build.gradle (Module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.admin.apollotest"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.apollographql.android:api:0.1.0' // the apollo runtime classes needed by auto-generated code
compile 'com.squareup.retrofit2:retrofit:2.1.0' // retrofit2
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' // rxjava2 to use the Observables stuff
compile 'com.apollographql.android:converter-pojo:0.1.0' // converts retrofit responses to pojos (ApolloConverterFactory)
}
apply plugin: 'com.apollographql.android'
apollo {
// this tells the apollo compiler to generate actual static classes instead of just interfaces (more on that later)
generateClasses = true
}
Run Code Online (Sandbox Code Playgroud)
让我以下错误:
错误为“找不到架构文件。请确保sourceSet目录中存在有效的schema.json文件”。
使用apollo-codegen download-schema命令创建此JSON。这将GraphQL端点的URL作为参数,后跟--output以及应该存储JSON的路径。JSON应该进入src/main/graphql/您的项目,并在其中进入子目录,这些子目录表示您希望代码进入的Java包(例如--output src/main/graphql/com/commonsware/graphql/trips/api/schema.json)。
因此,总的来说,您可能会:
apollo-codegen download-schema https://graphql-demo.commonsware.com/0.1/graphql --output src/main/graphql/com/commonsware/graphql/trips/api/schema.json
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4017 次 |
| 最近记录: |