失败:生成失败,发生异常。
出了什么问题:
在根项目“ MobileBuy”中找不到项目“ app”。
在构建项目时出现上述错误。但是在我的android项目中没有应用程序文件夹,那么为什么在根项目“ MobileBuy”中找不到此项目“ app”会收到此错误。
settings.gradle
include ':sample', ':buy3', ':buy3-pay-support', ':graphql-java-support'
project(':graphql-java-support').projectDir = new File('./libs/graphql_java_gen/support')
build.gradle
buildscript {
dependencies {
classpath dep.androidPlugin
classpath dep.retrolambda
classpath dep.butterknifePlugin
classpath dep.apolloPlugin
}
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.apollographql.android'
android {
compileSdkVersion androidConfig.compileSdkVersion
buildToolsVersion androidConfig.buildToolsVersion
defaultConfig {
applicationId "com.shopify.sample"
minSdkVersion androidConfig.minSdkVersion
targetSdkVersion androidConfig.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
all {
buildConfigField 'okhttp3.logging.HttpLoggingInterceptor.Level', 'OKHTTP_LOG_LEVEL', 'okhttp3.logging.HttpLoggingInterceptor.Level.BODY'
// We pull the shop settings either from the Environment or a file called shop.properties at the root of the project.
// Environment variables will take precedence, we will attempt to read those first.
def shopDomain
def apiKey
def androidPayPublicKey
def androidPayEnvironment
// get the shop setting from the environment if there any
shopDomain = System.getenv("SHOP_DOMAIN")
apiKey = System.getenv("API_KEY")
androidPayPublicKey = System.getenv("ANDROID_PAY_PUBLIC_KEY")
androidPayEnvironment = System.getenv("ANDROID_PAY_ENVIRONMENT")
// pull the store properties from the local file if it exists. Environment variables take precedence
def shopProperties = new Properties();
File shopPropertiesFile = project.file('shop.properties')
if (shopPropertiesFile.exists()) {
shopProperties.load(new FileInputStream(shopPropertiesFile))
shopDomain = shopDomain ?: shopProperties["SHOP_DOMAIN"]
apiKey = apiKey ?: shopProperties["API_KEY"]
androidPayPublicKey = androidPayPublicKey ?: shopProperties["ANDROID_PAY_PUBLIC_KEY"]
androidPayEnvironment = androidPayEnvironment ?: shopProperties["ANDROID_PAY_ENVIRONMENT"]
}
if (!shopDomain) {
shopDomain = ""
}
if (!apiKey) {
apiKey = ""
}
if (!androidPayPublicKey) {
androidPayPublicKey = ""
}
if (!androidPayEnvironment) {
androidPayEnvironment = "com.google.android.gms.wallet.WalletConstants.ENVIRONMENT_SANDBOX"
}
buildConfigField "String", "SHOP_DOMAIN", "\"" + shopDomain.toString() + "\""
buildConfigField "String", "API_KEY", "\"" + apiKey.toString() + "\""
buildConfigField "String", "ANDROID_PAY_PUBLIC_KEY", "\"" + androidPayPublicKey.toString() + "\""
buildConfigField "int", "ANDROID_PAY_ENVIRONMENT", androidPayEnvironment
debuggable = true
minifyEnabled = false
}
}
productFlavors {
shopify {
}
xApollo {
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile dep.androidSupportDesign
compile dep.androidSupportV4
compile dep.androidSupportV7
compile dep.androidSupportAnnotations
compile dep.rxAndroid
compile dep.rxJava
compile dep.timber
compile dep.butterKnife
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.apmem.tools:layouts:1.10@aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor dep.butterKnifeCompiler
compile(dep.fresco) {
exclude group: 'com.android.support'
}
compile dep.constraintLayout
compile dep.rxrelay
compile dep.archRuntime
compile dep.archExt
annotationProcessor dep.arcCompiler
compile project(':buy3-pay-support')
shopifyCompile project(':buy3')
xApolloCompile dep.apolloRuntime
xApolloCompile dep.okhttpLogging
xApolloCompile dep.apolloHttpCache
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'
compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
}
task downloadApolloSchema(type: DefaultTask, group: "GraphQL", description: "Download GraphQL store front API schema") {
doLast {
println("Downloading GraphQL schema...")
def schemaFile = new File(project.projectDir.absolutePath + '/src/xApollo/graphql/com/shopify/sample/domain/schema.json')
if (schemaFile.exists()) {
schemaFile.delete()
}
new URL('https://app.shopify.com/services/ping/storefront_graphql_schema').withInputStream { i ->
schemaFile.withOutputStream {
it << i
}
}
println("GraphQL schema has been downloaded!")
}
}
apollo {
customTypeMapping['URL'] = "String"
customTypeMapping['HTML'] = "String"
customTypeMapping['Money'] = "java.math.BigDecimal"
nullableValueType = "apolloOptional"
generateAccessors = false
useSemanticNaming = false
}