我從波紋管樣品使用,但讓我的錯誤,當我添加庫:使用Android的apollo graphql客戶端?
Using the apollo graphql client for Android
貝婁是我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
}
貝婁是我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
}
給我波紋管錯誤:
我該怎麼辦? 'apollo-codegen'不被識別爲內部或外部命令,可操作的程序或批處理文件。 –
@JoJoRoid:'apollo-codegen'是一個Node包。運行**'npm install -g apollo-codegen' **命令。這將在全球範圍內安裝'apollo-codegen',因此它適用於您希望使用Apollo-Android的任何Android項目。但請注意,使用'-g'開關進行全局安裝可能需要超級用戶權限(例如'sudo')在您的開發計算機上。 – CommonsWare
給我這個錯誤:錯誤:任務':app:installApolloCodegen'的執行失敗。 >處理'command'D:\ AndroidStudioProject \ TestApollo \ app \ .gradle \ nodejs \ node-v6.7.0-win-x64 \ node.exe''以非零退出值結束-4048 –