Saturday, 17 December 2022

Unable to build android app in github actions using docker, Could not resolve project :services. Required by: project :app

I am trying to build the app in github actions but I am facing an error which doesn't happen to me on my device when I run gradlew assembleDebug --stacktrace

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :services.
     Required by:
         project :app
      > No matching configuration of project :services was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

The project is a multimodule app

Here is the services gradle file

import dependencies.Apollo
import dependencies.Dependencies
import dependencies.RoomDependencies
import dependencies.Versions

plugins {
    id("com.android.library")
    id("kotlin-android")
    id("com.apollographql.apollo3")
    id("org.jlleitschuh.gradle.ktlint")
    id 'kotlin-kapt'
}
apollo {
    useVersion2Compat()
    generateKotlinModels.set(true)
    srcDir("src/main/graphql")
}

android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools
    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    buildTypes {
        release {
              }
        debug {

        }
    }
}

repositories {
    mavenCentral()
}
java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
    kapt("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)
    implementation project( ":linguisticdomain")
    // retrofit
    implementation(Dependencies.retrofit)
    implementation("com.google.android.gms:play-services-location:18.0.0")

    // room
    implementation(RoomDependencies.room_ktx)
    implementation(RoomDependencies.room_runtime)
    kapt(RoomDependencies.room_compiler)
    implementation(RoomDependencies.ROOM_TEST)
}

Here is the app gradle file

import dependencies.*
import dependencies.dependencies.SupportDependencies
import dependencies.dependencies.TestDependencies

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id "androidx.navigation.safeargs"
    id 'dagger.hilt.android.plugin'
    id 'com.google.gms.google-services'  // Google Services plugin
    id 'com.google.firebase.crashlytics'
    id 'org.jlleitschuh.gradle.ktlint'
}


android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools


    buildFeatures {
        compose true
        dataBinding = true
        viewBinding = true

    }


    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    defaultConfig {
        applicationId Application.id
        minSdkVersion Versions.minsdk
        targetSdkVersion Versions.targetsdk
        versionCode Application.version_code
        versionName "1.0.2"

        testInstrumentationRunner AndroidTestDependencies.instrumentation_runner

        // ...
        // Set the properties within `local.properties` into a `Properties` class so that values
        // within `local.properties` (e.g. Maps API key) are accessible in this file.
        Properties properties = new Properties()
        if (rootProject.file("local.properties").exists()) {
            properties.load(rootProject.file("local.properties").newDataInputStream())
        }

        // Inject the Maps API key into the manifest
        manifestPlaceholders = [mapsApiKey: properties.getProperty("MAPS_API_KEY", "")]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
        debug {
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
    }

    composeOptions {
        kotlinCompilerVersion Versions.kotlin
        kotlinCompilerExtensionVersion Compose.version
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project( ":linguisticdomain")
    implementation project( ":services")

    // Kotlin
    implementation Dependencies.kotlin_standard_library
    implementation Dependencies.ktx
    //implementation Dependencies.kotlin_extensions

    //support
    implementation SupportDependencies.appcompat
    implementation SupportDependencies.constraintlayout
    implementation SupportDependencies.material_design
    implementation SupportDependencies.legacy_support

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'




    //test
    testImplementation TestDependencies.junit4
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //navigation
    implementation Dependencies.navigation_fragment
    implementation Dependencies.navigation_ui

    //ktx
    implementation Dependencies.fragment_ktx
    //apollo
    implementation("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)

    compileOnly "org.jetbrains:annotations:16.0.1"

    //Build interactive settings screens without needing to interact with device storage or manage the UI.
    implementation Dependencies.android_preferences

    testCompileOnly "org.jetbrains:annotations:16.0.1"

    //debugging
    implementation Dependencies.timber
    //view_pager2
    implementation Dependencies.view_pager2
    // retrofit
    implementation Dependencies.retrofit
    implementation Dependencies.converter_moshi

    implementation "com.squareup.moshi:moshi:1.9.2"
    implementation "com.squareup.moshi:moshi-kotlin:1.9.2"

    implementation "com.squareup.retrofit2:converter-scalars:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'

    implementation 'com.facebook.android:facebook-android-sdk:5.15.3'

    implementation Dependencies.kotlin_coroutines_android
    implementation 'com.facebook.android:facebook-login:5.15.3'

    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'com.github.bumptech.glide:glide:4.12.0'


    implementation Compose.compose_ui
    implementation Compose.compose_tooling
    implementation Compose.compose_foundation
    implementation Compose.compose_material
    implementation Compose.compose_material_icons
    implementation Compose.compose_material_icons_ext
    implementation Compose.compose_activity
    implementation Compose.compose_viewModel
    implementation Compose.compose_livedata
    implementation Compose.constraint_layout
    implementation Compose.compose_run_time
    implementation "androidx.navigation:navigation-compose:2.6.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
    implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'

    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'

    implementation 'com.sagar:coroutinespermission:2.0.3'



    // UI Tests
    //   androidTestImplementation 'androidx.ui:ui-test:1.0.0-alpha05'
    androidTestImplementation TestDependencies.arch_core_testing

    implementation "com.google.dagger:hilt-android:2.42"
    kapt "com.google.dagger:hilt-android-compiler:2.42"


    implementation 'androidx.hilt:hilt-work:1.0.0'
    //this gets warning https://stackoverflow.com/questions/49602410/when-should-we-use-android-arch-lifecyclecompiler-or-android-arch-lifecycleco
//    kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"
    implementation Dependencies.work_manager
    implementation Dependencies.lottie_compose
    implementation Dependencies.lottie
    implementation Accompanist.insets
    implementation Accompanist.navigation_animation
    implementation Accompanist.coil

    implementation GoogleMaps.maps
    implementation GoogleMaps.mapsKtx
    implementation "com.github.PhilJay:MPAndroidChart:v3.1.0-alpha"
    implementation "io.github.vanpra.compose-material-dialogs:datetime:0.4.0"

    //firebase
    implementation platform('com.google.firebase:firebase-bom:28.1.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation("com.google.firebase:firebase-iid")
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    implementation 'com.google.firebase:firebase-core:20.0.2'

    //pusher beams
    implementation 'com.pusher:push-notifications-android:1.6.2'

    // Activity Compose
    implementation "androidx.activity:activity-compose:1.5.1"

    // CameraX
    implementation "androidx.camera:camera-camera2:1.0.2"
    implementation "androidx.camera:camera-lifecycle:1.0.2"
    implementation "androidx.camera:camera-view:1.0.0-alpha31"

    // qrcode
    implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'

}
kapt {
    correctErrorTypes true
    generateStubs = true

}

And that's the complete stack trace



from Unable to build android app in github actions using docker, Could not resolve project :services. Required by: project :app

No comments:

Post a Comment